Is it true if I use @Component (or @Named), I should include this class' package in the component scan's base package, but if I use @Bean then I don't have to make this class be inside any component scan package ?
@Bean is basically used on methods in @Configuration class.
@Component is used on class that signifies it is a Bean.
If you wrote all classes under the main package then you don't need @ComponentScan in Spring Boot. It will scan automatically.
But if you wrote the classes in different package than the main() method's class. Then you have to let Spring container know which packages to scan. You write them within @ComponentScan("xyz")