Junior — Middle
Does the @ComponentScan annotation have the ability to find only classes annotated with @Component?
sobes.tech AI
Answer from AI
The @ComponentScan annotation in Spring by default scans the specified packages and registers in the application context all classes annotated with annotations that are derived from @Component. This includes not only @Component, but also specialized annotations such as @Service, @Repository, @Controller, and others that are themselves annotated with @Component.
Thus, @ComponentScan finds not only classes with @Component, but also all classes with annotations based on @Component.