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

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/

Related

Can I use Spring Boot Admin on microservice?

I have a Spring Boot application which contains a Spring Batch mechanism that we run without an endpoint (reading from an API and updating the database), and in my application.yml we have web-application-type: none.
My application is not runnable using gradle boot:run, but I need to monitor its performance using SBA, the application is deployed as a jar, and I am running it using a ksh script.
Can I use SBA on a none-web Spring Boot app? How can I deploy it so it can monitor a jar?

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.

How to build and deploy Spring Boot no-web app to TomEE?

I have a simple Spring Boot JMS app like this. It have no web-layer and I don't want to add web layer to that app. It should be just one JMS microservice, hidden from web.
But I want to run it inside TomEE (as EJB or something). How can I do it?
you can deploy your app as an ear without any webmodule. Alternatively you can deploy it to openejb-standalone instead of tomee.

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 ?

Cloud Foundry : Spring boot vs WAR file

I am new to the world of Cloud, CloudFoundry, Saas, PaaS, IaaS, etc.
So I have few very fundamental questions.
Who is better Spring boot or war file in terms of deploying an application or a service to a cloud using cloud foundry?
WHY ?
If I want to deploy my war file on a PaaS cloud then who kicks it off?
As in where is the server?
How will I know which server my war file is deployed to?
Is using Spring-boot with embeded tomcat for PaaS mandatory?
What if my application does not use spring-boot (no spring reference in pom as well) then can I deploy my application war file on cloud? How?
There is nothing like better in war or Spring boot jar. They both are underhood same things, where Spring boot jar manages the server embedded in it and war does not have that.
Cloud Foundry has something like BuildPacks. You need to define a buildpack when you do a cf push. If you select a java build pack it has the things required to run a war on server. It gets the Java, Tomcat Server and all other dependencies needed to run the war.
https://github.com/cloudfoundry/java-buildpack
Cloud foundry creates a droplet, which is basically the execution context with all required dependencies. This is used to run the actual VM on the cloud.
You need not know which server your war is deployed to. That is the basic idea behind the cloud deployment. It may be on a single/multiple VMs under the hood. So what you need to know is something called routes. Routes are the actual addresses to your apps. You need to create routes and bind them to your application, and later app can be accessed using the routes.
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#routes
No using embedded servers is not mandatory in Any Cloud PAAS. War can be directly deployed. All PAAS platforms has support for this. Cloud foundry way of doing this is through build packs.
CF : https://docs.cloudfoundry.org/buildpacks/
Heroku : https://devcenter.heroku.com/articles/java-webapp-runner
Any application/ non spring apps which is plain war or jar can be used to run on PAAS platforms.

Resources