简体   繁体   中英

How can I redeploy multiple war files into a single Spring Boot deployable jar?

Currently I'm deploying multiple war files into a Tomcat container. Is it possible to use Spring Boot to put all war files into a single deployable jar? I know this is possible for a single app, but can it be done to deploy multiple apps that once were in separate war files?

Spring Boot by design will run one app (one war) per container. If you want to go for the uber-jar deployment I suggest you stay with this since it is following also 12-factor-app best practices.

If you want to run multiple war files in one tomcat I suggest you follow the "old way" wrapping up your spring boot apps in war files and deploy them in an already set up tomcat or jetty or ...

So the answer will be: in principle – and with a lot of tweaking – you might be able to achieve what you are trying to do but this is not the intend of the jar distribution of spring boot apps. And always remember: work with the framework and not against it.

Tomcat container browses through the web apps and maps each war with the context root defined in it (single property of the web.xml). So, i do not think you can do merge the files in only one and still treat them as separate web apps.

What can be done is to actually merge the code of the web apps in only war file and split the functionality based on different paths after the context root path.

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