@Primary
@Bean
public Foo getFoo() {...}
@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.
Mike opened SPR-10795 and commented
A
@Primary @Beancannot override a@ComponentScan-ed@Component.For example, if I have:
and a scanned:
... the
@Componentwill always be@Autowiredinstead 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:
@ComponentScanare skipped in@Configurationoverride4 votes, 8 watchers