zoukankan      html  css  js  c++  java
  • springboot集成redis 报错@Bean definition illegally overridden by existing bean definition@bean定义被现有bean定义非法重写

    在做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提示对错误的说明还是很清楚的了,仔细看看总能找到答案。

  • 相关阅读:
    关于JS的Date对象的探究
    讲解跨域---凭空多出来的一次请求?
    时间format函数引爆的知识点和年末有话说
    再不写篇博客感觉就凉了
    关于after和before
    怎么在Vue中使用Base64格式的背景
    Vue入门
    前端实现Tab切换栏
    死锁和约束(四)
    Java ClassLoad详解
  • 原文地址:https://www.cnblogs.com/DevMuYuer/p/12557189.html
Copyright © 2011-2022 走看看