-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
Mike opened SPR-10795 and commented
A @Primary @Bean cannot override a @ComponentScan-ed @Component.
For example, if I have:
@Primary
@Bean
public Foo getFoo() {...}
and a scanned:
@Component
public class Foo {...}
... the @Component will always be @Autowired instead of the @Primary-annotated @Bean. Nothing in the documentation says that @Primary @Bean's should fail against @ComponentScan-ed ones.
Affects: 3.2.3
Reference URL: http://stackoverflow.com/questions/17945290/spring-primary-fails-against-componentscan
Issue Links:
- Beans defined by @ComponentScan are skipped in @Configuration override [SPR-9567] #14201 Beans defined by
@ComponentScanare skipped in@Configurationoverride - ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForModelMethod should take into account the allowBeanDefinitionOverride settings [SPR-9682] #14316 ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForModelMethod should take into account the allowBeanDefinitionOverride settings
4 votes, 8 watchers
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply