天天看點

but 2 were found: - redisTemplate: defined by method 'redisTemplate'

錯誤:

Field reidsTemplate in com.jyall.cache.redis.annotation.RedisCache required a single bean, but 2 were found:

    - redisTemplate: defined by method 'redisTemplate' in class path resource [com/jyall/bonneuser/web/config/RedisConfigs.class]

    - stringRedisTemplate: defined by method 'stringRedisTemplate' in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration$RedisConfiguration.class]

出現2個一樣的模闆在容器中怎麼确認哪一個為有限級或者說那一個是主要的:

添加注解@Primary 在方法上

but 2 were found: - redisTemplate: defined by method 'redisTemplate'
but 2 were found: - redisTemplate: defined by method 'redisTemplate'

繼續閱讀