软件版本:
idea:2019.1 ultimate
springboot: 2.2.5
tomcat:9.0.31
一、修改默认打包方式,讲打包方式改为war
<version>0.0.1-SNAPSHOT</version>
<name>infocollection</name>
<description>Demo project for Spring Boot</description>
<!--在打包到生产环境Tomcat时指明打包方式-->
<packaging>war</packaging>
二、排除springboot内置的tomcat的容器
为什么要排除springboot内置tomcat呢?
因为如果不排除内置的tomcat,当我们打成war包发布到生产环境的tomcat时,就会出现两个tomcat冲突的问题。为了避免不必要的麻烦,所以这里排除内置的tomcat。
这里有两种方式可供选择:
-
使用
<exclusion>
标签,排除springboot中的内置tomcat:<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring