Spring / Spring Interview questions II
Difference between @Bean and @Component annotations in Spring.
@Component auto detects and configure the beans using classpath scanning. There is an implicit one-to-one mapping between the annotated class and the bean (i.e. one bean per class).
@Bean explicitly declares a single bean, rather than letting Spring do it automatically. It decouples the declaration of the bean from the class definition, and lets you create and configure beans exactly how you choose.
More Related questions...