1.在pom文件里添加
war
-
pom的 中添加
项目名称 -
pom添加:
org.springframework.boot
spring-boot-starter-tomcat
provided
javax.servlet
javax.servlet-api
3.1.0
provided
4 改动启动类 继承SpringBootServletInitializer,重写configure方法
@SpringBootApplication
@ServletComponentScan
public class NoticeApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(NoticeApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(NoticeApplication.class);
}
}