Multiple Context path for different war in WildFly - spring

I am deploying my web app in WildFly 23.0.0 Final and I'm using spring application.
I would like to have different Context path for the diffrent war in one deploy:
http://ip:8080/xxx-ui
http://ip:8080/xxx-rest
http://ip:8080/xxx-cron
Can someone show me how to do this ?

Related

Spring webApp cannot load beans defined in another web app in tomcat/lib

I have a spring web app that has multiple modules, and I want to deploy in tomcat server 9, for on of these applications has a dependency with another jar located in tomcat/lib.
in the pom.xml I defined the scope as provided
when I deploy I can't get beans defined in the jar.
Any help please

Spring Boot with maven war dependancy

I have Spring Boot web project with dependency to maven overlay war file which is also Spring web project. War is included in pom.xml.
How can I deploy that war along with Spring Boot application so I can use rest endpoints that belong to war file. I'm trying to start application from STS simply by running it as Java application. While application is starting, I can see only URLs that belong to Spring Boot project, but URLs that belong to war file are missing.
I believe Spring boot does not support that. See issue here
Try building a war and deploying it into a container.

Deploy a war file inside the embedded servlet container in a Spring Boot web application

I want to deploy one or more already existing war files into the embedded servlet container in the Spring Boot project.
Specifically, I want to fire up both the hawtio and the ActiveMQ Web Console wars inside the same application, in addition to some of my own stuff.
Is there a correct way to do this, or do I have to go for the "nuclear option" of configuring the servlet container instance myself? (Note that I'd rather have Jetty than Tomcat, but if it is one line with Tomcat, and lots of cruft with Jetty, then Tomcat is okay)

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.

How to create deployable springboot war

I am trying to create a maven spring boot application to be deployed in Tomcat. I am following what is suggested in Spring docs and other stackoverflow suggestions- war, Application.java extending SpringBootServletInitializer, removing spring-boot-maven-plugin from build plugins etc. War file is generated and is deployed in tomcat. But what I found is all static files are packaged under /WEB-INF/classes folder and I am not able to access the page. My project structure is as below:
Can anybody tell me how I can package the war properly to be deployed in Tomcat.
That doesn't change anything.
If you put your static assets in src/main/resources/static (and they end up in WEB-INF/classes/static), Spring Boot will serve them properly. So a src/main/resources/static/foo.png will be available at http://localhost:8080/your-context/foo.png if the context of your webapp is your-context.
Regarding the configuration, you can also go on start.spring.io, click advanced and chose war and you'll get an empty project pre-configured.
Or you can click this: https://start.spring.io/#!packaging=war
The issue is because of version issue. I compiled the application with Java 8 and deployed it in tomcat running under JRE 7. It may help someone facing the same issue.
I got the clue from the below post:
Spring boot war file deploy on Tomcat.

Resources