In this topic I will overview spring boot package scanning.
You can find some basic information in spring boot docs in the following link (using-boot-structuring-your-code) but I will try to provide more detailed information.
Spring boot, and spring in general, provide a feature to automatically scan packages for certain annotations in order to create
|@SpringBootApplication||Main spring boot application annotation. used one time in the application, contains a main method, and act as main package for package scanning|
|@SpringBootConfiguration||Indicates that a class provides Spring Boot application. Should be declared only once in the application, usually automatically by setting |
|@EnableAutoConfiguration||Enable auto-configuration of the Spring Application Context. Should be declared only once in the application, usually automatically by setting |
|@ComponentScan||Used to trigger automatic package scanning on a certain package and its children or to set custom package scanning|
|@Configuration||Used to declare one or more |
|@Bean||Indicates that a method produces a bean to be managed by the Spring container. Usually |
|@Component||By declaring a class as a |
|@Repository||Originally defined by Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage. It is usualy used to indicate a |
|@Service||Very similar in practice to |
|@Controller||Indicates that an annotated class is a "Controller" (e.g. a web controller).|
|@RestController||A convenience annotation that is itself annotated with |