Spring Boot automatic configuration Principle Analysis

 

 

 1. @ SpringBootConfiguration comment

Spring framework @Configuratin annotations are provided, a configuration represents the current class is class.

@SpringBootConfiguration annotations and notes are @Configuratin may be configured to identify a category scanned by the scanner assembly,

But @SpringBootConfiguration is Spring Boot been re-naming and packaging.

2. @ EnableAutoConfiguration comment

 

@EnableAutoConfiguration annotation is a combination of notes by @AutoConfigurationPackage and annotations

@Import ({AutoConfigurationImportSelector.class}) annotation components.

(1) @AutoConfigurationPackage comment

 

The main effect of the annotation is to obtain the root item of the main program, thereby specifying the position of the following package assembly of the scanner to be scanned.

(2) @Import (AutoConfigurationImportSelector.class {}) annotations

 

3. @ ComponentScan comment

@ComponentScan annotation component package is a scanner for the specified package annotation class automatic assembly into Spring Bean container.

Root @ComponentScan annotation packet by the particular scan Spring Boot item of the main program where the position determining package, during the scanning process,

@AutoConfigurationPackage analyzing the annotation, whereby Spring Boot project main program starts the specific location where the package type.

Guess you like

Origin www.cnblogs.com/my-program-life/p/12181488.html
Recommended