问题
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