Tomcat
introduce
Lightweight Web application server
Container architecture
Container handling
Servlet startup process parsing
Preparation before startup
- The refresh method
- CreateApplicationContext method
- Context is determined based on the webApplicationType attribute
- Initialize DEFAULT_SERVLET_WEB_CONTEXT_CLASS
WebServer create entry
- refreshContext
- refresh
- onRefresh
- createWebServer
WebServer to create
- getWebServerFactory
- factory.getWebServer
- Set webServer properties
- initPropertySources
The servlet start
- refresh
- finshRefresh
- startWebServer
- publishEvent
Web container factory class load parsing
- Configuration is introduced into
- Annotation processing
- Container factory class introduced
Web container personalization
Properties into
- Configure web container properties such as server.xxx=xyz
- Inject into the ServerProperties class
- Automatic configuration class import WebServerFactoryCustomizer implementation class
- ServerProperties becomes an implementation property
Factory initialization
- GetWebServerFactory gets the concrete Web service factory class
- Initialize the concrete implementation class with a call to doGetBean
- Traversing BeanPostProcessor implements bean processing
- WebServerFactoryCustomizerBeanPostProcessor realization method
BeanPostProcessor method implementation
- postProcessBeforeInitialization
- getCustomizers()
- Get all the WebServerFactoryCustomizer implementation class
- The customize method of the implementation class is called in turn