已解决spring boot org.springframework.context.annotation.ConflictingBeanDefinitionException异常的正确解决方法,亲测有效!!!

文章目录

    • 报错问题
    • 解决方法
    • 福利

报错问题

粉丝群里面的一个小伙伴敲代码时发生了报错(当时他心里瞬间凉了一大截,跑来找我求助,然后顺利帮助他解决了,顺便记录一下希望可以帮助到更多遇到这个bug不会解决的小伙伴),报错信息如下:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com..Application]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean **name 'DeExecutor' for bean class [com.Executor] conflicts with existing, non-compatible bean definition of same name and class** [com.r.Executor]
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:692)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
	at com.main(Application.java:11)
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'DefRuleExecutor' for bean class [com..Executor] conflicts with existing, non-compatible bean definition of same name and class [com.Executor]
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:348)
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:286)
	at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:288)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170)
	... 13 common frames omitted

解决方法

解决方法如下


annotation.ConflictingBeanDefinitionException说明是系统内的注解错误,在继续往下看bean definition of same name 定义了相同的bean这就看你系统内的service及component里面写的名称是不是有重复的?如果是修改点重复的就可以了。

org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean ****name ‘DeExecutor’ for bean class [com.DefRuleExecutor] conflicts with existing, non-compatible bean definition of same name and class

福利

每周会送6本技术书籍包邮到家
由于博主时间精力有限,每天私信人数太多,没办法每个粉丝都及时回复
大家可以进社区裙或者添加博主微信
点击下方链接即可
http://t.csdn/6kInJ

更多推荐

已解决spring boot org.springframework.context.annotation.ConflictingBeanDefinitionE