idea报错-Caused by: org.springframework(javabean冲突)

  • Post author:
  • Post category:java


Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'brandController' for bean class [com.changgou.goods.controller.BrandController] conflicts with existing, non-compatible bean definition of same name and class [com.changgou.controller.BrandController]
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:348) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:286) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
	... 13 common frames omitted

报错:说在项目中找到了有相同的实现类名在不同的package目录下,查看项目代码并未发现问题。

非常奇怪,两个bean冲突了,代码中怎么也找不到com.changgou.controller.BrandController这个,回想下,

最开始我手写了这个BrandController类,后来用代码生成器生成了,代码移植过来后,就把这个删了,两个类的包确实不一样,

检查代码虽然我已经删了以前的BrandController代码,但是我之前已经build了,生成了.class文件了

解决办法:

打开maven,maven clean一下即可。


https://program.blog.csdn.net/article/details/87882242



版权声明:本文为ZHOU_VIP原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。