简体   繁体   中英

What happens during WAR packaging in spring boot? Can we have both external Tomcat and Embedded Tomcat for a single application?

I actually want to know what exactly happens during WAR packaging of a spring boot application using Maven. My specific interest would be to know whether the embedded tomcat dependency will be included or not while packaging app as WAR.

Also, If we have some tomcat config properties defined in application.properties and deploy the WAR file to external Tomcat which config will be taken into account while running the application? Like the config properties defined in server.xml of Tomcat server or the properties defined in application.properties?

My specific interest would be to know whether the embedded tomcat dependency will be included or not while packaging app as WAR

This is covered in the Spring Boot reference documentation :

If you use the Spring Boot build tools, marking the embedded servlet container dependency as provided produces an executable war file with the provided dependencies packaged in a lib-provided directory. This means that, in addition to being deployable to a servlet container, you can also run your application by using java -jar on the command line.

When you deploy a war to Tomcat, the configuration in server.xml is used rather than the server- and Tomcat-related configuration in application.properties . Specifically, none of your application's server.* properties will have any effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM