BeanDefinitionOverrideException尽管启用了Spring属性覆盖

huangapple go评论82阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年5月5日 14:35:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/61607129.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定