• org.springframework.beans.factory.BeanDefinitionStoreException


    控制台打印错误:
    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.dhc.springboot.SpringbootApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'helloController' for bean class [com.dhc.springboot.sys.controller.HelloController] conflicts with existing, non-compatible bean definition of same name and class [com.dhc.springboot.practice.controller.HelloController]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.2.jar:2.5.2]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.2.jar:2.5.2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.2.jar:2.5.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.2.jar:2.5.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.2.jar:2.5.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.2.jar:2.5.2]
    at com.dhc.springboot.SpringbootApplication.main(SpringbootApplication.java:13) [classes/:na]
    Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'helloController' for bean class [com.dhc.springboot.sys.controller.HelloController] conflicts with existing, non-compatible bean definition of same name and class [com.dhc.springboot.practice.controller.HelloController]
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:349) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:287) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:296) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207) ~[spring-context-5.3.8.jar:5.3.8]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175) ~[spring-context-5.3.8.jar:5.3.8]
    ... 13 common frames omitted

    Disconnected from the target VM, address: '127.0.0.1:57069', transport: 'socket'

    Process finished with exit code 1
    报错误说无法分析配置类。

    有两个相同名称的HelloController,去掉一个或者更改一个名字就可以了。

  • 相关阅读:
    UIGestureRecognizer在多层视图中的触发问题
    mysql出现Waiting for table metadata lock的原因及解决方案
    SQL逆向工程
    自己总结的ruby on rails 查询方法
    hdu 1536 SG函数模板题
    spring 源码分析之BeanPostProcessor
    spring bean生命周期管理--转
    java.lang.Long cannot be cast to java.lang.Integer解决办法
    Mybatis之Oracle增删查改示例--转
    Anti-If: The missing patterns--转
  • 原文地址:https://www.cnblogs.com/dhc1995/p/15026741.html
Copyright © 2020-2023  润新知