前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException

作者头像
是阿超
发布2021-10-15 15:45:26
8560
发布2021-10-15 15:45:26
举报
文章被收录于专栏:CSDN

已解决

报错信息

在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'myCenterController' for bean class [com.tanhua.sso.controller.MyCenterController] conflicts with existing, non-compatible bean definition of same name and class [com.tanhua.server.controller.MyCenterController]
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:348) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:286) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.2.RELEASE.jar:5.1.2.RELEASE]
	... 13 common frames omitted

分析报错信息

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException ConflictingBeanDefinitionException:Bean定义冲突异常

Annotation-specified bean name ‘myCenterController’ for bean class [com.tanhua.sso.controller.MyCenterController] conflicts with existing, non-compatible bean definition of same name and class [com.tanhua.server.controller.MyCenterController] 大致意思是: 为bean类指定注解的bean名称’myCenterController’ [com.tanhua.sso.controller.MyCenterController] 关键词与现有的、不兼容的同名类bean定义冲突[com.tanhua.server.controller.MyCenterController]

首次分析

com.tanhua.sso.controller.MyCenterController里面的注解或者包引用了com.tanhua.server.controller.MyCenterController模块的

在这里插入图片描述
在这里插入图片描述

分析结果

查了一遍都没问题

再次分析

因为我是运行启动的server模块的启动类,所以暂时分析是server模块的pom文件依赖了同级模块sso的pom文件,从而导致出现了这个错误

分析结果

server模块的pom文件依赖了同级模块sso的pom文件

在这里插入图片描述
在这里插入图片描述

处理方式

删除这个server模块的pom依赖

处理结果

启动成功

在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021/06/02 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 报错信息
  • 分析报错信息
    • 首次分析
      • 分析结果
        • 再次分析
          • 分析结果
          • 处理方式
          • 处理结果
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档