Spring boot uses war package to deploy to external Tomcat process analysis

Time:2020-5-22

This article mainly introduces the process analysis of spring boot deployed to external Tomcat using war package. The example code is introduced in detail in this article, which has certain reference value for your study or work. You can refer to the following for your friends

If the war package is deployed to the external tomcat, you need to add the springbootservletinitializer subclass and override its configure method, or inherit the class of the main function from the springbootservletinitializer subclass and override the configure method.

@SpringBootApplication
//Inherit the springbootservletinitializer subclass
public class Demo2Application extends SpringBootServletInitializer {

  //Override the configure method
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Demo2Application.class);
  }
  public static void main(String[] args) {
    SpringApplication.run(Demo2Application.class, args);
  }
}

The above is the whole content of this article. I hope it will help you in your study, and I hope you can support developepaer more.

Recommended Today

Tomcat tuning notes

This article is the experience (which will be updated continuously) obtained in the Tomcat tuning process. Relevant environment: java version “1.8.0_131” Tomcat 8.5.14 Jmeter 3.1 JMeter parameter: 300 threads 1000 cycles URL:http://localhost:8080/ Tomcat server.xml Parameters: protocol=”org.apache.coyote.http11.Http11Nio2Protocol” acceptCount=”5000″ maxConnections=”20000″ Tomcat JVM parameters:-server -Xms4g -Xmx4g JIT intervention Tomcat server.xml Keep the default values. When Tomcat is not […]