Running multiple spring boot web app on tomcat - spring

I am trying to deploy multiple spring boot web app on tomcat. All have the same application.properties.How can I split the configuration files for different app running on tomcat.

Spring Boot doesn't require an external Tomcat, because it contains its own embedded Tomcat. So you can run all of your application in it's own Tomcat on the same machine. All you have to do is to define different ports for your applications via server.port property.

Related

Multiple spring boot jar deployment open liberty

How to deploy multiple spring boot application jar in open liberty server?
You cannot have multiple SpringBoot uber jar applications running in the same Liberty server. You will need to either use multiple Liberty servers or you will need to change to use the war option for SpringBoot. You can deploy multiple SpringBoot war applications to a single Liberty server.

Spring boot webservice to start and be discoverable when JBOSS EAP starts

We need to create independent spring boot web services for our apps which runs in JBOSS EAP. Can we do the below if its possible.
Spring Boot is typically deployed as a runnable jar but our apps are EAR deployed. Can we bootstrap / launch the spring boot listener / controller when the EAR application starts)
Can we register the services on start to facilitate automated discoverability of services (typically done with consul/ etcd/ zookeeper etc)
You can generate a WAR instead of a JAR and deploy this. If this is not ok you can put the WAR in an EAR
Read the docs: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html
Yes. If you have a service registry in place you can use this with Spring Cloud.
Please read the documentation:
https://spring.io/guides/gs/service-registration-and-discovery/

Spring boot and Tomcat : Is it better to use embeded Tomcat or external Tomcat installation.

I was wondering if some experienced spring boot users can tell us how to choose between embedded Tomcat and external Tomcat installation.
Thanks in advance.
Embedded Tomcat helps you to define Standalone application. Earlier we have to deploy war to Tomcat Server which itself a tedious task. From the embedded tomcat you can run application as service without worrying about the deployment thing. As now days microservices are being popular, spring boot is more popular because of its feature one of them is embedded servers like Tomcat,Jetty or Netty.

Spring boot 2 with webflux and Router functions war does not work with standalone tomcat server

The application runs fine on spring boot embedded tomcat 8.5.28 (gradle bootRun) but when I create the war and put the same in stand alone tomcat server (8.5.28) the application always throws 404 for any of the routes configured.
The application runs fine on spring boot embedded tomcat 8.5.28 (gradle bootRun) but when I create the war and put the same in stand alone tomcat server (8.5.28) the application always throws 404 for any of the routes configured.
Spring Boot 2.0 does not currently support WAR deployment for WebFlux applications.
See the Spring Boot issue you created: https://github.com/spring-projects/spring-boot/issues/12455

Spring webflux on tomcat

I just created a new application using Spring boot 2 M7 and I'm using spring-webflux.
I built the application as an autoexecutable war that I can start in dev with java -jar app.war and also on a standalone tomcat server for UAT purpose.
In the web reactive reference doc, I read
To deploy as a WAR to a Servlet 3.1+ container, wrap HttpHandler with ServletHttpHandlerAdapter and register that as a Servlet. This can be automated through the use of AbstractReactiveWebInitializer.
Baeldung site also wrote about it and they describe a procedure to register a servlet that wrap the router for a standalone environment.
Using Spring boot tomcat starter, I didn't need to do anything : no code about booting the server necessary ; the app starts using the embedded server. In debug I saw NIO access so all seems fine.
I didn't try yet but what will happen on a standalone tomcat using Spring boot tomcat starter and webflux starter ? Is spring boot take care of everything (embbeded and standalone tomcat) ? how does it work ?

Resources