I have a server module that depends on web modules:
<dependency> <groupId>org.ema.server</groupId> <artifactId>web</artifactId> <version>0.0.1-SNAPSHOT</version> <type>war</type> </dependency>
which gets repackaged using spring-boot-maven-plugin to get standalone:
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> <mainClass>org.ema.server.Server</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
Everything is still working. The web module is included in the final bank as BOOT-INF/lib/web-0.0.1-SNAPSHOT.war .
I know that Spring allows you to load additional war files for Tomcat at run time , but it looks like such a war file should be located somewhere in the file system, or I'm doing it wrong.
The question is, how can I maintain a standalone feel, but can I still add war files to my final standalone jar and deploy them to the built-in Tomcat?
Below is the code that shows how to do this, but I'm not sure that this can be done the way I require it:
@Bean public EmbeddedServletContainerFactory servletContainerFactory() { LOGGER.info("Adding web app"); return new TomcatEmbeddedServletContainerFactory() { @Override protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) {
spring boot tomcat
Stefan falk
source share