Problems in Redis injection
Problems that arise
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;
The solution is to change the original @Autowired to @Resource where RedisTemplate is imported .