1、排除springboot中默认容器支持
<!-- springboot 的web包(版本号同父级相同) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--排除内置容器,排除内置容器导出成war包可以让外部容器运行springboot项目-->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
2、加入servlet-api并去掉springboot对jsp支持
3、在入口类中加入如下配置:
4、将项目打包(war)部署到外部容器即可,打的包在target下