Springboot is a new lightweight framework based on spring, and the most powerful part is automatic configuration. Then we can take a look at how to achieve automatic configuration based on the startup process and related principles.
Specific steps
- 1. SpringAplication starts, run the run method to create a new SpringApplication object, and initialize the SpringApplication object
- Second, the run method of the SpringApplication object creates and starts the timing monitoring class
- Three, set the value of java.awt.headless through configureHeadlessProperty
- Fourth, call getRunListeners to create all spring listeners
- Five, initialize application parameters through DefaultApplicationArguments
- Six, prepare the spring environment according to the running listener and parameters through prepareEnvironment
- Seven, call the createApplicationContext method to create an application context
- Eight, prepare the application context through prepareContext
- Nine, refresh the context through the refreshContext method
- 10. Call the stop method to stop the timing monitor class
- 11. Call started to publish the application context start completion event
- Twelve, call the callRunners method to execute all runner runners
- Thirteen, call running to publish the application context ready event
- 14. Finally return to the application context
1. SpringAplication starts, run the run method to create a new SpringApplication object, and initialize the SpringApplication object
Call the run method to
create a new SpringApplication object to
initialize the SpringApplication object
Second, the run method of the SpringApplication object creates and starts the timing monitoring class
Three, set the value of java.awt.headless through configureHeadlessProperty
Specific setting method
Fourth, call getRunListeners to create all spring listeners
Five, initialize application parameters through DefaultApplicationArguments
Six, prepare the spring environment according to the running listener and parameters through prepareEnvironment
Seven, call the createApplicationContext method to create an application context
Eight, prepare the application context through prepareContext