spring boot 打war包,最简单的方式
作者:互联网
1. 启动类继承SpringBootServletInitializer,重写configure方法
1 @SpringBootApplication 2 public class MyApplication extends SpringBootServletInitializer { 3 4 public static void main(String[] args) { 5 SpringApplication.run(MyApplication.class, args); 6 } 7 8 @Override 9 protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { 10 return builder.sources(MyApplication.class); 11 } 12 }
2. pom.xml:
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
3.
标签:spring,boot,war,public,SpringBootServletInitializer,MyApplication,class 来源: https://www.cnblogs.com/powerbear/p/14846699.html