bean名称相同冲突Annotation-specified bean name 'xx' for bean class [xxx] conflicts with existing, non-compatible bean definition of same name and class[xxx]
工程中引入其他工程的包,由于两个工程中有重名的两个bean,导致在启动时提示如下错误:
根据bean名称在ide中查找,找到这两个重名的类,可以看到由于这两个类使用@Service标注,此时如果不使用命名,那么Spring会在扫描时,将类名首字母小写作为key,放到一个全局Map中维护。此时,会出现两个键相同的Service,由于Spring不使用覆盖的方式处理具有相同键的不同全类名,所以扫描时提示冲突。
解决方法:保持容器中bean的名称不重复,对其中的一个bean进行自定义命名。
bean名称相同冲突Annotation-specified bean name 'xx' for bean class [xxx] conflicts with existing, non-compatible bean definition of same name and class[xxx]的更多相关文章
- 获取并打印Spring容器中所有的Bean名称
思路: 1.实现Spring的ApplicationContextAware接口,重写setApplicationContext方法,将得到的ApplicationContext对象保存到一个静态变量 ...
- Spring中用@Component、@Repository、@Service和 @Controller等标注的默认Bean名称会是小写开头的非限定类名
今天用调度平台去调用bean中的方法时,提示找不到bean.经查,发现是由于如果在标注上没有提供name属性值,则默认的bean名称是小写开头的,而不是大写开头的. 下面是其他文档参阅: 使用过滤器自 ...
- 【Spring】10、Spring中用@Component、@Repository、@Service和 @Controller等标注的默认Bean名称会是小写开头的非限定类名
@Service用于标注业务层组件(我们通常定义的service层就用这个) @Controller用于标注控制层组件(如struts中的action) @Repository用于标注数据访问组件,即 ...
- Spring中默认bean名称的生成策略/方式修改
最近公司项目打算模块化,其实一个原因也是为了能够整合公司多个业务的代码,比如一个资源xxx,两个业务中都有对这个资源的管理,虽然是一个资源,但是是完全不同的定义.完全不同的表.不同的处理逻辑.所以打算 ...
- 创建在类路径资源[applicationcontext]中定义名为“工厂”的bean时出错。:在设置bean属性“dataSource”时,无法解析对bean“dataSource”的引用;嵌套异常是org.springframe .beans.factory。BeanCreationException:创建名为“数据源”的bean时出错,该名称是在类路径资源[applicationcontext
控制台报错: 创建在类路径资源[applicationcontext]中定义名为“工厂”的bean时出错.:在设置bean属性“dataSource”时,无法解析对bean“dataSource”的引 ...
- Spring MVC-处理程序映射(Handler Mapping)-Bean名称Url处理程序映射(Bean Name Url Handler Mapping)示例(转载实践)
以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_beannameurlhandlermapping.htm 说明:示例基于Spri ...
- SpringMVC conflicts with existing, non-compatible bean definition of same name and class 的解决办法
问题起因 最近,项目组的里的同事遇到一个问题,他自己负责的模块,SpringMVC的Controller与其他模块的Controller 类名重名了,导致整个工程都起不来了. 后台报的错误是这样的: ...
- Annotation-specified bean name 'userDaoImpl' for bean class [***] conflicts with existing, non-compatible bean definition of same name and class [***]
使用Spring开发的时候报错如下: Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionExcept ...
- spring 'arroudAspect' for bean class [com.dw.test.ArroudAspect] conflicts with existing, non-compatible bean definition of same name and class [com.dw.aspect.ArroudAspect]
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: ...
随机推荐
- MySQL Replication--多线程复制MTS
多线程复制 多线程复制MTS(Mult-Threaded Slave Applier)指使用多个线程来并发应用二进制日志.在MYSQL5.6版本中,多线程复制基于schema来实现,将多个数据库下的事 ...
- PHP提示 Notice: Undefined variable
PHP提示Notice: Undefined variable,意思是:你的程序中有未定义的变量 为什么在其他地方好好的程序,换个环境报这个Notice,因为php.ini提醒级别设置的问题 场景复原 ...
- 【RocketMQ】同一个项目中,同一个topic,可以存在多个消费者么?
一.问题答案 是不可以的 而且后注册的会替换前注册的,MqConsumer2会替换MqConsumer,并且只结束tag-2的消息 /** * @date 2019/05/28 */ @Compone ...
- 树莓派3b安装opencv
前言:最近买了一个CSI接口的摄像头,最准用树莓派做人脸识别项目.树莓派上本身已经安装了python2.python3,最开始通过sudo apt-get install python3-opencv ...
- CentOS7源码安装Redis5.0.4非关系型数据库
源码安装redis-5.0.4 一. 下载redis 1. 需要连接网络 二. 案例(另一种安装方法) [root@localhost ~]# wget http://download.redis.i ...
- 2018年第十届ACMICPC四川省大学程序设计竞赛
..拿金了 没给学校丢脸 A ....SB题啊 比赛的时候都没看 裸的一个bitset前缀和 先开一个1e4*1e4的二维bitset数组 初始第i个数组的值为1 << i (即B[i]= ...
- windows(hexo)使用git时出现:warning: LF will be replaced by CRLF
hexo出现warning: LF will be replaced by CRLF git config --global core.autocrlf false //禁用自动转换
- webpack-dev-server 本地代理proxy
proxy: [ { context: ['/user', '/rights', '/resource/getAdNotice'], target: 'https://plus.m.jd.com', ...
- Alpha冲刺(10/10)——追光的人
1.队友信息 队员学号 队员博客 221600219 小墨 https://www.cnblogs.com/hengyumo/ 221600240 真·大能猫 https://www.cnblogs. ...
- Python3 - 基础(运算符)
Python3-运算符 举个简单的例子 4 +5 = 9 . 例子中,4 和 5 被称为操作数,"+" 称为运算符. 算术运算符 比较(关系)运算符 赋值运算符 逻辑运算符 位运算 ...