- 修改pom文件的 打包方式 由 jar->war
- 添加 jar
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- 过滤内置tomcat-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starte-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
- 启动类的同级目录 添加类
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
}
期间 如果报错
Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
等等错误
clean tomcat clean工程
至此 配置完毕 亲测 有效 如有问题 请留言 不定期回复。。。。
网友评论