英文:
BeanDefinitionOverrideException although Spring-Property overriding is enabled
问题
尽管在主应用程序的 application.yml 中启用了 spring 属性 allow-bean-definition-overriding: true
,但我仍然遇到了异常。有什么线索吗?
应用程序启动
***************************
应用程序启动失败
***************************
描述:
无法注册类路径资源中定义的 'httpSessionManager' Bean。在 URL [...HttpSessionManager.class] 中已经定义了具有相同名称的 Bean,并且禁用了覆盖。
操作:
考虑将其中一个 Bean 进行重命名,或者通过设置 spring.main.allow-bean-definition-overriding=true 来启用覆盖。
测试启动
***************************
应用程序启动失败
***************************
描述:
无法注册 'metaDataSourceAdvisor' Bean。已经定义了具有相同名称的 Bean,并且禁用了覆盖。
操作:
考虑将其中一个 Bean 进行重命名,或者通过设置 spring.main.allow-bean-definition-overriding=true 来启用覆盖。
英文:
Although the spring-property allow-bean-definition-overriding: true
is enabled in the main application.yml, I am getting an Exception. Any clue why?
Application Start
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'httpSessionManager', defined in class path resource [...], could not be registered. A bean with that name has already been defined in URL [...HttpSessionManager.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Test Start
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'metaDataSourceAdvisor' could not be registered. A bean with that name has already been defined and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
答案1
得分: 1
如果您查看错误信息,它说:
> 考虑重命名其中一个Bean,或通过设置 spring.main.allow-bean-definition-overriding=true 来启用覆盖。
请确保您的 allow-bean-definition-overriding 属性位于 spring.main 元素下。
英文:
If you look at the error message, it says:
> Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true.
Make sure your allow-bean-definition-overriding property is under the spring.main element.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论