springboot启动故障:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse confi

这篇具有很好参考价值的文章主要介绍了springboot启动故障:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse confi。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

启动时错误如下:

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xxx.xx.BootApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘userController’ for bean class [com.xxx.xx.controller.web.UserController] conflicts with existing, non-compatible bean definition of same name and class [com.xxx.xx.controller.api.UserController]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:189) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.7.RELEASE.jar:2.3.7.RELEASE]
at com.xxx.xx.BootApplication.main(BootApplication.java:14) [classes/:na]
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘userController’ for bean class [com.xxx.xx.controller.web.UserController] conflicts with existing, non-compatible bean definition of same name and class [com.xxx.xx.controller.api.UserController]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.checkCandidate(ClassPathBeanDefinitionScanner.java:349) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:287) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:296) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:250) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:207) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:175) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
… 14 common frames omitted

Process finished with exit code 1

解决:

上面意思是,加载注解的Bean时有同名类,因此不被允许。
错误信息也列出了同名类的具体位置:[com.xxx.xx.controller.api.UserController],[com.xxx.xx.controller.web.UserController],将其中一个文件名和类名改名即可,这是springboot常见的错误。文章来源地址https://www.toymoban.com/news/detail-605164.html

到了这里,关于springboot启动故障:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse confi的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 已解决org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans.factor

    已解决org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans.factory.异常的正确解决方法,亲测有效!!! org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans.factor 对于 org.springframework.beans.factory.UnsatisfiedDependencyException 异常,通常是由于依赖注

    2024年02月05日
    浏览(37)
  • 关于org.springframework.beans.factory.NoSuchBeanDefinitionException

    这个报错可能是因为: 1. spring的xml配置文件Bean中的id和getBean的id不一致 spring的配置文件中: 而程序中 applicationContext.getBean(“studenta”, Student.class)中的是studenta而spring配置文件的id是student,不一致。 2. 是否是忘记加注解了 @Resource或@Autowired都可以(@Resource是jdk自带的) 3.如果

    2024年02月13日
    浏览(51)
  • exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException

    原因: Spring Boot异常org.springframework.beans.factory.NoUniqueBeanDefinitionException:没有可用的合格Bean类型:预期匹配单个Bean,但是匹配到了多个,当该bean被自动装配时与Spring Boot应用程序上下文中的两个或多个加载的Bean匹配时,就会发现该异常。 Spring Boot允许从一个接口或抽象类创

    2024年02月09日
    浏览(29)
  • Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException

    修改为:    解决办法: BookDao层中添加@Mapper, 告诉springboot这是一个mybatis代理接口类型, 快来扫描我!, 由此生成代理对象 原因三:   测试类ModuleSetApplicationTests和引导程序ModuleSetApplication没有在同名包下, 例如下图, ModuleSetApplication类在com.itheima下ModuleSetApplicationTests没有直接在com

    2024年02月11日
    浏览(36)
  • 报错:Caused by org.springframework.beans.factory.BeanCreationException

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [spring/spring-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type ‘java.lang.String’ to

    2024年02月13日
    浏览(36)
  • org.springframework.beans.factory.BeanCreationException: Error creating bean with name

    异常日志:[WARNING] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name \\\'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping\\\': Initialization of bean failed; nested exception is org.springframework.beans.fac

    2024年02月02日
    浏览(70)
  • 异常:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name

    出现这种异常主要是无法创建bean到容器中,主要有以下几种情况: 1.注解没有添加: controller: 注: controller类要加入@RestController注解,@AllArgsConstructor注解视情况而定。 引入了private final IEnterpriseService service,所以需要注入,可以在controller类上加入@AllArgsConstrctor注解修饰。

    2024年02月21日
    浏览(35)
  • 报错org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name...

    刚学SpringBoot,今天启动的时候报错了,长长的一堆报错信息 报错信息大概说的是创建UserController bean出现错误 下面又说创建UserService bean出现错误和UserMapper也出错 于是我百度了一下,都说没加注解,我检查了一下,改加的都加了呀 于是我又分别测试了一下mapper和service 又说报

    2024年02月04日
    浏览(48)
  • Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit

    是因为没有扫描到 mapper,在启动类或者配置类中@MapperScan配置包扫描,或者使用@Mapper注解Mapper接口

    2024年02月16日
    浏览(37)
  • 已解决Application run failed org.springframework.beans.factory.BeanNot

    问题原因:SpringBoot的版本与mybiats-puls版本不对应且,spring自带的mybiats与mybiats-puls版本不对应 这里我用的是3.2.2版本的SpringBoot,之前mybiats-puls版本是3.5.3.1有所不同。 问题:版本对不上 解决办法:完整粘贴就好

    2024年02月21日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包