0

Is it possible to run multiple Spring Boot projects on same port by building one more project and add these projects as module and run.

PKumar
  • 516
  • 9
  • 20

2 Answers2

1

From the Spring Boot Guide:

If you accidentally run a web application twice you will see a “Port already in use” error. STS users can use the Relaunch button rather than Run to ensure that any existing instance is closed.

So I'm guessing that it isn't possible to run two instances of boot on the same port. I don't think that it is possible to use more than one tomcat service on the same port. See this for a discussion on tomcat.

Community
  • 1
  • 1
px06
  • 2,256
  • 1
  • 27
  • 47
  • Can you please help me to run https://github.com/eugenp/spring-security-oauth/ The developer asked to run on 8081, how is it possible. @px06 – PKumar Jul 29 '16 at 09:32
  • That repository contains several demo projects, you can compile and run any of them as the port is already set to `8001` in all of them. Server run port is typically defined in `/src/main/resources/application.properties` for Spring boot projects. – px06 Jul 29 '16 at 10:50
  • Thanks @px06 for your quick response – PKumar Jul 29 '16 at 11:04
1

you can run if you are using a tomcat server behinde.

also you can change the port of you aplication from the application.properties. for your case github.com/eugenp/spring-security-oauth , you just go on https://github.com/eugenp/spring-security-oauth/blob/master/spring-security-oauth-server/src/main/resources/application.properties and change it to what port you want

  • Thanks @Vasile, but I am not getting "behind tomcat server", could you please elaborate. I am running through tomcat wrapped in Spring Boot. – PKumar Jul 29 '16 at 11:06
  • this are the setting you might use to deploy on tomcat, but since you are using the wrapper from Spring Boot I don't think you have access to them http://stackoverflow.com/questions/8823290/how-to-run-different-apps-on-single-tomcat-instance-behind-different-ports – Vasile Adrian Brusturean Jul 29 '16 at 11:31