一:引入maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<packaging>war</packaging>
二:核心启动类加相关配置
package com.sx.file;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class DockerwebApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(DockerwebApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(DockerwebApplication.class, args);
}
}
一切欧克,将war包上传到服务器
打工告成!
评论