报错详情
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'redisTemplate', defined in class path resource [com/sxt/config/RedisConfig.class], could not be registered. A bean with that name has already been defined in class path resource [com/sxt/config/CacheConfig.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
报错原因:
存在重复的Bean
解决办法:
在配置文件中添加如下配置,名称相同的会覆盖
spring:
main:
allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
觉得有用点个赞再走。