首页

解决globalExceptionHandlerResolver..Consider renaming one of the beans..spring.main.allow-bean-definition-overriding=true报错问题

标签:globalExceptionHandlerResolver,allow-bean-definition-overriding     发布时间:2022-06-30   

一、异常说明

项目启动报“The bean 'globalExceptionHandlerResolver', defined in class path resource ...could not be registered. A bean with that name has already been defined in URL..Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true”错误,详情日志如下>>

***************************@b@APPLICATION FAILED TO START@b@***************************@b@@b@Description:@b@@b@The bean 'globalExceptionHandlerResolver', defined in class path resource [com/xwood/cloud/common/core/config/XxxSystemBasicConfiguration.class], @b@@b@could not be registered. A bean with that name has already been defined in URL [jar:file:/E:/Repository/Jar/cn/com/xwood/cloud/xx-common-core/1.1.2-SNAPSHOT/xw-common-core-1.1.2-SNAPSHOT.jar!/com/xwood/cloud/common/core/exception/GlobalExceptionHandlerResolver.class] and overriding is disabled.@b@@b@Action:@b@@b@Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true@b@@b@@b@Process finished with exit code 1

二、解决方法

将bootstrap.properties中的spring.main.allow-bean-definition-overriding=true改为application.yml的配置方式

spring:@b@  main:@b@    allow-bean-definition-overriding: true
  • ◆ 相关内容