SpringBoot The core feature of
SpringBoot It's a scaffold , Built on Spring Based on the framework , Based on the idea of rapid construction , Provides automatic configuration function , It can be realized Open the box Characteristics of ( After creating a basic project , We can run our project with zero or a small amount of configuration ), The core of it is as follows :
- Start relying on (Starter Dependency)- When a project is created, the underlying layer helps you associate dependencies .
- Automatic configuration (Auto Configuration)
- health examination (Actator)- monitor
SpringBoot Execution principle
SpringBoot When the project starts , First, based on the annotation description on the startup entry class , Automatically configure and scan the specified package and sub package classes for loading , Then check whether there is Spring The annotation specified in the frame describes ( for example @Component,@Controller,@Service etc. ). If there is , Give the class to Spring In the framework BeanFactory Factory interface implementation class object , This factory object is created based on reflection Bean Example , If so Bean Specifies the lifecycle method , It also calls the lifecycle method . When the instance is created ,Spring The framework will also be based on the scope description of the class , Store instances in containers with different scopes , In order to realize the Bean The scientific object of application .