First, modify the Pom file 1. Because Tomcat is embedded in springboot, it is necessary to remove the embedded Tomcat plugin
1 <Dependency>2 <groupId>Org.springframework.boot</groupId>3 <Artifactid>Spring-boot-starter-web</Artifactid>4 <!--Remove embedded Tomcat -5 <Exclusions>6 <exclusion>7 <groupId>Org.springframework.boot</groupId>8 <Artifactid>Spring-boot-starter-tomcat</Artifactid>9 </exclusion>Ten </Exclusions> One </Dependency>
2. Modify the packaging format
1 < Packaging >War</packaging>
3. Adding Servlet-api Dependencies
1 <Dependency>2 <groupId>Org.apache.tomcat</groupId>3 <Artifactid>Tomcat-servlet-api</Artifactid>4 <version>8.5.32</version>5 <Scope>Provided</Scope>6 </Dependency>
Second, deploy to server 1. First configure the environment on the server, such as JDK, MySQL, Tomcat, and so on, the version and the Pom file configured in the same 2. Copy the packaged war package to the WebApps directory of Tomcat
3. Start Tomcat in the bin directory
Spring Boot: Project is packaged into a war and published to Tomcat run