I have googled about this problem, but I'm not finding anything for this case. I found lots of "how to deploy Spring Boot WAR to Tomcat" but nothing about wrapping an existing Tomcat WAR with Spring Boot.
I'm trying to wrap an existing WAR with a Spring Boot "wrapper" so that the existing code base doesn't have to be reconfigured. This solution doesn't work because it depends on the WAR being available at an absolute location, whereas we are trying to package the "application" WAR inside the Spring Boot WAR. We can then add the context for the WAR like this:
Context context = tomcat.addWebapp("myapp", Thread.currentThread().getContextClassLoader().getResource("myapp.war").getPath());
This is almost working. I'm having a problem with one specific issue. When the existing WAR file is dropped into the Spring Boot project, it gets dropped into /WEB-INF/lib-provided
instead of /WEB-INF/classes
. I can't find a way to get the embedded Tomcat to add a WAR file from this location. The ClassLoader won't load it because it's not under WEB-INF/classes
.
Is there a slick way (or any way) of grabbing this WAR from /WEB-INF/lib-provided
?