spring boot初始化过程设置启动时执行某个函数

mac2025-12-15  6

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.

最新回复(0)