Closed
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
@ComponentScan
are skipped in@Configuration
override - 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