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

已解决

报错信息

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException_第1张图片

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文件
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException_第2张图片

处理方式

删除这个server模块的pom依赖

处理结果

启动成功
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException_第3张图片

你可能感兴趣的:(错误解决方法,java)