RedisLockClient类注入报错

Blade 未结 2 1109
bluerose
bluerose 剑圣 2021-11-09 23:29
悬赏:10

一、该问题的重现步骤是什么?

1.  在bladex项目内blade-log服务内的controller或service 注入RedisLockClient redisLockClient;

2.  nacos注册中心配置锁的redis配置:

blade:

    lock:

        enabledtrue

        addressredis://192.168.3.5:6379

        password:

3. 启动bladex项目内blade-log服务


二、你期待的结果是什么?实际看到的又是什么?

应该和没注入此类前一样正常启动,但是一旦注入这个类就会报错


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

blade 2.8.2.RELEASE

四、请提供详细的错误堆栈信息,这很重要。

2021-11-09 23:21:52.866  INFO 15892 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...

2021-11-09 23:21:52.871  INFO 15892 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed

2021-11-09 23:21:52.888  INFO 15892 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2021-11-09 23:21:52.909 ERROR 15892 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Parameter 1 of constructor in org.springblade.core.log.controller.LogApiController required a bean of type 'org.springblade.core.redis.lock.RedisLockClient' that could not be found.



Action:


Consider defining a bean of type 'org.springblade.core.redis.lock.RedisLockClient' in your configuration.



Process finished with exit code 1


五、若有更多详细信息,请在下面提供。

因为我看bladex示例并没有使用过这个锁类,而我正好要用到,所以直接就在bladex里的log-service注入此类,但是一旦注入就要报错,去掉就不会。我也看了blade-starter-redis的源码,有autoconfiguration动态注入,实在不知道什么原因。谢谢


另外,我是下载的bladex最新代码来试的,没有修改过其他代码。

2条回答
  • 2021-11-10 01:58

    我本地测试没问题,你打个断点看看是否读取到enabled的配置了,我怀疑还是读取的false,所以他的config类没有生效


    image.png


    image.png

    0 讨论(0)
  • 2021-11-10 12:05

    谢谢

    0 讨论(0)
提交回复