1、在容器初始化的时候执行
If you need to perform servlet context initialization in a Spring Boot application, you should register a bean that implements the org.springframework.boot.web.servlet.ServletContextInitializer
interface. The single onStartup
method provides access to the ServletContext
and, if necessary, can easily be used as an adapter to an existing WebApplicationInitializer
.