zoukankan      html  css  js  c++  java
  • 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,去掉一个或者更改一个名字就可以了。

  • 相关阅读:
    如何禁止复制网页内容?(javascript)
    CSS实现的div仿制Textarea效果
    C/S WinForm自定义控件实现B/S菜单样式
    ER/Studio 数据库建模
    设为首页JS,加入收藏夹js,加入收藏夹代码,设为首页代码,火狐和ie兼容
    entity framework进行一对多的联合查询
    增加asp.net应用程序性能的19种方法
    MVC Models定义验证属性
    [导入]linq与xml
    Entity Framework 批量删除
  • 原文地址:https://www.cnblogs.com/dhc1995/p/15026741.html
Copyright © 2011-2022 走看看