在做springboot集成redis时报如下错误:

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'cacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/RedisCacheConfiguration.class]: @Bean definition illegally overridden by existing bean definition: Generic bean: class [com.muyuer.bee.engine.cache.memory.MemoryCacheManager]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [applicationContext-bee.xml]

百度居然没有相关文章,google也没有.
没办法只能仔细查看错误信息,关注到@Bean definition illegally overridden by existing bean definition,意思是@bean定义被现有bean定义非法重写,查看org/springframework/boot/autoconfigure/cache/RedisCacheConfiguration.class源码里面有一个@bean 名称为cacheManager,再看自己代码里也有一个同样名称的接口定义,报着试一下,把自己代码里的CacheManager接口改了一个名字,再运行居然成功了。

其实idea提示对错误的说明还是很清楚的了,仔细看看总能找到答案。

相关文章:

  • 2022-01-31
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2021-04-17
  • 2021-05-20
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
相关资源
相似解决方案