SpringBoot

1 将SpringBoot打成war包

(1)添加Tomcat依赖,去除Tomcat



    org.springframework.boot
    spring-boot-starter-tomcat
    provided

(2)将jar包修改为war包

war

(3)添加Servelt依赖

这一步我并没有使用,也可以


    javax.servlet
    javax.servlet-api
    3.1.0
    provided

(4)修改启动类

@SpringBootApplication
public class DemoApplication  extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(DemoApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

(5)修改打包名称


 lock
    
    
        org.springframework.boot
        spring-boot-maven-plugin
    
    

用finalName定义最后输出的war包的名称。

 

 

 

 

 

 

 

 

0

 

你可能感兴趣的:(SpringBoot)