Start the Sprignboot project with tomcat

Generally, the Springboot project runs the main function in the Application by default. If you want to use tomcat to start, you need to add the following configuration

public class ServletInitializer extends SpringBootServletInitializer {

   @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      return application.sources(Application.class);
   }

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326082188&siteId=291194637