一、该问题的重现步骤是什么?
1. 下载2.8版本
2. 配置好redis、数据库连接
3.启动
二、你期待的结果是什么?实际看到的又是什么?
期待正常启动
实际看到
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-04-28 07:59:49.946 ERROR 15884 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method bladeRedis in org.springblade.core.redis.config.RedisTemplateConfiguration required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'redisTemplate' in 'RedisTemplateConfiguration' not loaded because @ConditionalOnMissingBean (names: redisTemplate; SearchStrategy: all) found beans named redisTemplate
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.core.RedisTemplate' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:7071', transport: 'socket'
Process finished with exit code 1
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
bladex 单体 2.8版本 window8.1环境
四、请提供详细的错误堆栈信息,这很重要。
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-04-28 07:59:49.946 ERROR 15884 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method bladeRedis in org.springblade.core.redis.config.RedisTemplateConfiguration required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'redisTemplate' in 'RedisTemplateConfiguration' not loaded because @ConditionalOnMissingBean (names: redisTemplate; SearchStrategy: all) found beans named redisTemplate
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.core.RedisTemplate' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:7071', transport: 'socket'
Process finished with exit code 1
五、若有更多详细信息,请在下面提供。
官方git私服原版有这个问题么?你有没有改动过其他的地方,看报错是其他的地方先初始化了redisTemplate,导致RedisTemplateConfiguration本身的初始化没有生效,@ConditionalOnMissingBean直接跳过了。
但是BladeX系统本身除此之外没有其他地方初始化过redisTemplate,而RedisTemplateConfiguration也是在RedisAutoConfiguration之前初始化的所以不会被其影响。
你需要排查一下本工程其他地方有没有对其实例化,BladeX只有一处
这是本地启动成功的截图
另外商业版答疑规则见:https://sns.bladex.cn/article-14990.html
请将账号邮箱修改为下单购买授权的qq邮箱便可咨询商业版疑问
代码里面没有自己额外实例化redisTemplate,如果不使用BladeRedis 能正常启动,使用就报错
2.报错信息
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'addressEndPointV2': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bladeRedis' defined in class path resource [org/springblade/core/redis/config/RedisTemplateConfiguration.class]: Unsatisfied dependency expressed through method 'bladeRedis' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.redis.core.RedisTemplate<java.lang.String, java.lang.Object>' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
Parameter 0 of method bladeRedis in org.springblade.core.redis.config.RedisTemplateConfiguration required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'redisTemplate' in 'RedisTemplateConfiguration' not loaded because @ConditionalOnMissingBean (names: redisTemplate; SearchStrategy: all) found beans named redisTemplate
启动过程中对 AddressEndPointV2类进行实例化失败,里面用到了bladeRedis注入失败,原因是对AddressEndPointV2进行实例化的优先于bladeRedis的实例化导致 无法注入
扫一扫访问 Blade技术社区 移动端