码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot之打war包

时间:2018-05-29 10:20:12      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:boot   []   protected   conf   UI   artifact   方法   dma   rri   

1.在 maven的 pom 中添加 

<packaging>war</packaging>

2. 修改tomcat 依赖

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
</dependency>

3. 主类继承 SpringBootServletInitializer,实现 configure 方法

@SpringBootApplication
public class Application extends SpringBootServletInitializer{

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(JobManagementApplication.class);
    }
    public static void main(String[] args) {
       SpringApplication.run(JobManagementApplication.class, args);
    }
}    

4.打包

mvn clean package  -Dmaven.test.skip=true

 

SpringBoot之打war包

标签:boot   []   protected   conf   UI   artifact   方法   dma   rri   

原文地址:https://www.cnblogs.com/appleat/p/9103288.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!