Redis注入中出现的问题
出现的问题
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-08-23 16:38:42.294 ERROR 32136 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field redisTemplate in com.lxz.gateway.util.RedisUtil required a bean of type 'org.springframework.data.redis.core.RedisTemplate' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'org.springframework.data.redis.core.RedisTemplate' in your configuration.
@Resource
private RedisTemplate<String, Object> redisTemplate;
解决的方式就是在导入RedisTemplate的地方,由原先的
@Autowired
变成
@Resource
就可以了。
版权声明:本文为weixin_41957626原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。