-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Dave Syer opened SPR-10607 and commented
ConfigurationClassBeanDefinitionReader does not allow a @Bean
to override anything that is not itself a @Bean
:
if (!(existingBeanDef instanceof ConfigurationClassBeanDefinition)) {
// no -> then it's an external override, probably XML
// overriding is legal, return immediately
...
The assumption that non-@Beans
come from XML is false, since they can be (and increasingly are) registered by an import selector or similar piece of framework machinery. In any case this seems like an arbitrary rule (XML beans are just as valid to override as any other). All users really need is some predictability about the bean definition load order, so they can reason about what should override what.
Affects: 4.0 M1
Issue Links:
- Regression in 4.0.0 - A scoped-proxy bean cannot override another bean [SPR-11229] #15854 Regression in 4.0.0 - A scoped-proxy bean cannot override another bean
- Reconsider whether to generally allow bean overriding by name [SPR-10808] #15434 Reconsider whether to generally allow bean overriding by name
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement