标签:gap ret 修改 spring str main source ted extends
spring boot项目默认是使用内嵌的tomcat打包为jar的方式,我们可以进行一些修改让其打包方式为war包:
修改maven的pom.xml
<packaging>war</packaging>
然后将内嵌的tomcat依赖修改为:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web-tomcat</artifactId> <scope>provided</scope> </dependency>
然后把启动的主类修改一下:
public class TestApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(TestApplication.class); } public static void main(String[] args) throws Exception { SpringApplication.run(TestApplication.class, args); } }
之后再使用maven进行打包就是war包的形式了。
标签:gap ret 修改 spring str main source ted extends
原文地址:http://www.cnblogs.com/meetzy/p/7991764.html