No Data

springboot3打war包

原创  作者:斩雪碎光阴  发布于:2023年10月01日  阅读量:138
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
  分类:  标签:

1.增加ServletInitializer


import org.springframework.boot.builder.SpringApplicationBuilder;

import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;


public class ServletInitializer extends SpringBootServletInitializer {

   @Override

   protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {

       return application.sources(XxxApplication.class);

   }

}


2.application.properties

server.servlet.CONTEXT_PATH=/xxx


3.pom.xml

......

xxx

war

......

       

           org.springframework.boot

           spring-boot-starter-web

           

               

                   org.springframework.boot

                   spring-boot-starter-tomcat

               

           

       

       

           org.springframework.boot

           spring-boot-starter-tomcat

           

           provided

       

       

       sgymwb

       


           ......


           

           

               org.apache.maven.plugins

               maven-war-plugin

               3.2.3

               

                   false

                   

                       

                           libs

                           WEB-INF/lib/

                           

                               **/*.jar

                           

                       

                       

                       

                           src/main/resources

                           

                               **/*.*

                           

                       

                   

               

           

       


4.其他文件目录

newboot


src/main/webapp

META-INF/resources

**/*.*


src/main/java

**/*.xml


src/main/resources

**/*.*

org.springframework.boot

spring-boot-maven-plugin

相关文章