Linux系统中tomcat部署springboot注意事项(war包部署)

1.修改pom.xml(移除嵌入式tomcat插件,并添加servlet-api的依赖)

       

    org.springframework.boot

    spring-boot-starter-web

   

   

       

            org.springframework.boot

            spring-boot-starter-tomcat

       

   

    javax.servlet

    javax.servlet-api

    3.1.0

    provided

2.修改启动类(继承 SpringBootServletInitializer 并重写 configure 方法)

public class application extends SpringBootServletInitializer{

@Override

    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {

        return builder.sources(application .class);

    }

    public static void main(String[] args) {

        SpringApplication.run(application .class, args);

        System.out.println("------ scl-admin启动成功------ ");


    }

}

3.打war包

修改pom.xml  war

run->pageck->去target目录查看 war文件

4.把war文件放入tomcat  webapp目录,启动tomcat

你可能感兴趣的:(Linux系统中tomcat部署springboot注意事项(war包部署))