Spring Initializr to create WAR for tomcat?

萝らか妹 提交于 2020-02-07 02:35:10

问题


I would like to use the Spring Initializr to create WAR for tomcat...
Our DevOps are still not used to the idea of running java as a standalone and would like to have the application as a WAR in tomcat

I was able to produce a project but it seems like its producing a standalone spring boot application

I still want to use Spring Initializr to produce all the dependencies like :

  • Rest Repositories
  • JDBC template
  • Quartz
  • REST

One solution is to create a dynamic web project in eclipse and use Spring Initializr then just copy all the pom dependency into the dynamic web project is there a better way?


回答1:


To build a deployable war file into an external container, you have to :

  • Reconfigure your project to produce a WAR
  • Declare the embedded container ( Tomcat ) dependency as provided

    <packaging>war</packaging>
    
    <dependencies>
        ...
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        ...
    </dependencies>
    


来源:https://stackoverflow.com/questions/55599566/spring-initializr-to-create-war-for-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!