Redis注入中出现的问题

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就可以了。

灵感来自于Field redisTemplate in ... required a bean of type ...RedisTemplate' that could not be found._CrazySnail_x的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/weixin_41957626/article/details/132455843