In the development phase we recommend the use of inline tomcat for development, because this is much easier, but to build the environment, I want to run in a standalone Tomcat container because we need to do additional optimizations for Tomcat, and then we need to package the project into a war package for publishing.
1.1. The project is packaged in the form of war
1.2. Set the range of Spring-boot-starter-tomcat to provided
Set to provided will exclude the package when it is packaged, because it is not required to be run in a standalone tomcat.
1 <dependency>23 <groupId>org.springframework.boot</groupId> 4 5 <artifactId>spring-boot-starter-tomcat</artifactId>67 <scope>provided </scope>89 </dependency>
1.3. Modify the code to set the startup configuration
You need to integrate the Springbootservletinitializer and then rewrite the Configure to set the Spring boot entry class in.
1.4. Fight a war bag
Package success:
1.5. Deploy to Tomcat
Unzip the apache-tomcat-7.0.57.tar.gz, unzip the war packet to the root directory under WebApps, and start:
Perfect!
Publish the Springboot project to a standalone Tomcat run