Spring / Spring Interview questions II
What is the difference between @Configuration and @Component in spring?
@Configuration Indicates that a class declares one or more @Bean methods and may be processed by the Spring container to generate bean definitions and service requests for those beans at runtime.
@Component Indicates that an annotated class is a "component". Such classes are considered as candidates for auto-detection when using annotation-based configuration and classpath scanning.
@Configuration is also a @Component as it is meta-annotated with @Component, so @Configuration classes are eligible for component scanning.
More Related questions...