1 、--in the packaging release Springboot, first in the Pom.xml springboot embedded Tomcat removed, so that when packaging will not hit the Tomcat jar package
As shown below:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--exclude built-in containers and exclude built-in containers from exporting to a war package allows external containers to run spring-boot items--
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
If you also need inline tomcat, set the Tomcat scope scope to privided
As shown below:
<!--load built-in tomcat--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>privided</scope>
</dependency>
2 、--Pack The Springboot into a war directly after deploying to Tomcat's WebApps, the following problems are encountered
Want to access the project directly through the IP address, but found that the project executed two times in Tomcat boot, the first execution does not error, the second execution error
Workaround: Do not put the project under Tomcat's WebApps, put it in a different directory, and then configure the Server.xml file in the Config folder
For example, my configuration is placed in the D:\apache-tomcat-8.5.32\myproduct directory audio-0.0.1-snapshot is the project name
Unpackwars= "true" autodeploy= "true" >
<context path= "/" docbase= "D:\apache-tomcat-8.5.32\myproduct\audio-0.0.1-SNAPSHOT" debug= "0" Reloadable= "false" crosscontext= "false" >
</Context>
</Host>
This solves the problem, and starting Tomcat again will only be accessed once.
Springboot Packaging releases Tomcat encounters bugs and workarounds