目录
外置tomcat方式部署springboot
1、打包方式的改变
<packaging>jar</packaging>
//修改为
<packaging>war</packaging>
2、去除springboot中内置的tomcat(.xml中)
<!-- 打成war的时候打开注释,本地开发用内嵌tomcat时加上注释 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
3、启动类中增加 继承SpringBootServletInitializer,重写configure方法
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
//重写configure方法
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(EurekaServerApplication.class);
}
}
标签:configure,tomcat,外置,SpringBootServletInitializer,springboot,EurekaServerApplicat
From: https://www.cnblogs.com/lgxdev/p/16650842.html