When developing Spring Boot applications, tell the Spring Framework where to look for Spring components. A Component scan is one way for Spring to detect managed components from Spring. When the application starts, Spring needs the information to locate and register all Spring components in the application context. Spring can scan, detect and instantiate components from predefined project packages automatically. Spring can automatically scan all classes with stereotypes @Component, @Controller, @Service and @Repository For example import org.springframework.stereotype.Component;
@Component("demoBeanA")
public class DemoBeanA {
}