3.Spring-Boot introduced the core @SpringBootApplication

1. the Spring the Boot core
1.1. Inlets classes and @SpringBootApplication
Spring Boot projects generally have * Application class entry, the entry will be the main method in the class, which is the entrance to a standard method of Java applications.
@SpringBootApplication annotation is the core Spring Boot notes, it is actually a combination of notes:

 
The annotation is mainly a combination of the following notes:
  1. @SpringBootConfiguration: This is the configuration annotations Spring Boot project, which is a combination of notes:

  1. @ SpringBootConfiguration recommended alternative @Configuration in Spring Boot project
  2. @EnableAutoConfiguration: Enable automatic configuration, the automatic annotation makes Spring Boot Configuration item in the project according to the project dependent jar package:
    1. Such as: we added a spring-boot-starter-web of dependence, the project also will be introduced SpringMVC dependence, Spring Boot will automatically configure tomcat and SpringMVC

  1. @ComponentScan: default scan @SpringBootApplication the same directory where the class and its subdirectories.
1.2.    Close autoconfiguration
Through the above, we are told, Spring Boot will depend on the jar package according to the project, to make automatic configuration, Spring Boot support auto-configuration is as follows (very much):
If we do not need Spring Boot auto-configuration, to turn off automatically configure an item, how to set it?
 For example: we do not want to automatically configure Redis, I would like to manual configuration.
 Of course, the other configuration is similar to the
 

                                                                       Micro-channel public number: 

                                               

                                                                             JAVA program ape growth path

                          Resource sharing, recording program ape growing little by little. Focus on Java, Spring, SpringBoot, SpringCloud, distributed, slightly services. 

Guess you like

Origin www.cnblogs.com/niugang0920/p/12197085.html