How to start multiple spring-boot applications using Maven, say Client on port 8081 and API on port 8080 - maven

I have a multi-module project developed using Spring Boot managed by Maven. There are two spring boot applications, say the API which runs on port 8081 and the thymeleaf client which runs on port 8080. I would want to bootrun both the applications in a single maven command from the root project. Currently, I am explicitly starting each of the application class. How do I achieve this using Maven.?
The project folder structure is as below.
1 RootProject - pom.xml
1.1--API(Spring Boot Project) with port 8080- pom.xml
1.2--Client(Spring Boot Project) with port 8081 - pom.xml
Thanks,
KR

Related

Debug Spring Boot app from Intellij where service is started in a multi service docker-compose file?

I have a docker-compose YML file that includes multiple Spring Boot apps.
Is it possible to debug one of these Spring Boot apps from Intellij?
I guess it depends how the apps are started within the Docker container. One option could be starting the application in debug mode with the following in the Dockerfile of the app you want to debug:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar myApp.jar
Remember to build your container again and then attach a remote debugger with IntelliJ to the port 8000.

Manage build profiles/configs for Spring Boot application

I have written application using spring boot + scala with sbt and now I need to divide build configurations for dev and prod.
What has been done: created configs application.yml and application(-dev/prod).yml to start application locally, on dev and prod respectively.
What need to be done: find a way to configure spring boot profile (dev, prod) in javaopts or directly write corresponding config, also in javaopts.
I've tried to use these opts:
sbt service/run -Dspring.profiles.active=...
sbt service/run -Dspring.config.location=...
The answer is to configure active profile like this:
sbt service/run --spring.profiles.active=...

how to deploy the different spring boot micro service in tomcat with eureka, zuul server too?

I have bellow spring boot microservice. these jar files
1, test-service -port no-8100
2, test-service -port no-8101
3, Zuul server, config server also there.
how to deploy the above service in tomcat server
Modify your maven or gradle build to produce a Package as a war.

how to deploy Spring Cloud war to old container

I had a Spring Cloud project which was deployed in embeded tomcat. Now I modify the project add web.xml and make the Application class extends SpringBootServletInitializer. I followed the instruction of 81.5 Deploying a WAR in an Old (Servlet 2.5) Container in below link. But I found that the application.properties was not loaded. And the server port listed in application.properties was not listened.
[http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html#howto-servlet-2-5]
Deploying a WAR in an Old (Servlet 2.5) Container
application.properties
spring.application.name=api-gateway
server.port=5555
# routes to serviceId
zuul.routes.api-a.path=/api-a/**
zuul.routes.api-a.serviceId=service-A
zuul.routes.api-b.path=/api-b/**
zuul.routes.api-b.serviceId=service-B
# routes to url
zuul.routes.api-a-url.path=/api-a-url/**
zuul.routes.api-a-url.url=http://localhost:2222/
eureka.client.serviceUrl.defaultZone=http://localhost:9999/eureka/

Apache camel app behaves differently in Tomcat when deployed with Maven

I do not understand the situation: whe I use Maven to deploy Apache camel routes to the Tomcat I do not see any routes with JMX. But if I package war with Maven and deploy it manually (copy *.war to webapps directory) - everything works fine.
What could cause such a behavior!?

Resources