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:
Dave Syer opened SPR-10607 and commented
ConfigurationClassBeanDefinitionReader does not allow a
@Beanto override anything that is not itself a@Bean:The assumption that non-
@Beanscome 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: