作者:runyuantezhong773 | 来源:互联网 | 2023-10-11 13:43
1,修改pom.xml
1
2 org.springframework.boot
3 spring-boot-starter-web
4
5
6
7 org.springframework.boot
8 spring-boot-starter-tomcat
9
10
11
12
13
14 javax.servlet
15 javax.servlet-api
16 3.1.0
17 provided
18
2,将打包方式设置成war
war
3,修改springboot启动类,注释原有代码,添加以下代码
1 public static void main(String[] args) {
2 SpringApplication.run(Application.class, args);
3 }
4
5 @Override
6 protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
7 return builder.sources(this.getClass());
8 }
4,添加Tomcat容器,运行
SpringBoot 取消内置Tomcat启动,改用外接Tomcat