springboot打包 jar war
2020-03-22 本文已影响0人
火山脚下
//打jar包,还需要修改pom.xml文件的<packaging>jar</packaging>
//@SpringBootApplication
//public class Demo2Application{
// public static void main(String[] args) {
// SpringApplication.run(Demo2Application.class, args);
// }
//}
//打war包,还需要修改pom.xml文件的<packaging>war</packaging>
@SpringBootApplication
public class Demo2Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Demo2Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Demo2Application.class);
}
}
image.png