-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed as not planned
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
environment: spring boot 2.6.10
define a demo app with following configuration class:
@Configuration
public class DemoConfig {
@Bean("aaa")
public String foo() {
return "foo";
}
@Bean("aaa")
public String bar() {
return "bar";
}
}
should be: BeanDefinitionOverrideException
is: bean named "aaa" added to bean context (with value "foo"), method bar() never added to bean definition
debugging shows a return statement here, that seems to the cuprit.
Lines 212 to 219 in 8fe6a9f
| if (isOverriddenByExistingDefinition(beanMethod, beanName)) { | |
| if (beanName.equals(beanMethod.getConfigurationClass().getBeanName())) { | |
| throw new BeanDefinitionStoreException(beanMethod.getConfigurationClass().getResource().getDescription(), | |
| beanName, "Bean name derived from @Bean method '" + beanMethod.getMetadata().getMethodName() + | |
| "' clashes with bean name for containing configuration class; please make those names unique!"); | |
| } | |
| return; | |
| } |
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid