Annotations in SpringBoot and Spring

SpringBoot

1. @SpringBootApplication--Enable component scanning and automatic configuration.

Equivalent to @Configuration, @ComponentScan in Spring, and @EnableAutoConfiguration in SpringBoot

2.@EnableAutoConfiguration--Enable SpringBoot's automatic configuration mechanism

Help SpringBoot applications load all eligible @Configuration configurations into the current SpringBoot, create a Bean corresponding to the configuration class, and hand the Bean entity to the IoC container for management.

Spring

1. @Configuration-indicates that this class uses Spring java-based configuration.

2. @ComponentScan--Enable component scanning.

 Scan beans annotated by @Component (@Service,@Controller). By default, the annotation scans all classes in the package where the class is located. In this way, the Web controller classes and other components you write can be automatically discovered and registered as beans in the Spring application context.

3.@EnableAutoConfiguration can also be called @Abracadabra--

Guess you like

Origin blog.csdn.net/VABTC/article/details/111994572