Is there a way to run multiple Spring Boot applications with a single Running Configuration in IntelliJ IDEA?

Viewed 25982

I have multiple spring boot applications in a single IntelliJ project. And i want to have a single button to run all of them in some order.

I know there is an option to Run Another configuration before launching the original one, so in that way the configurations can be chained.

But when i use it, it runs that Another Configuration and doesn't run the original one.

So I'm wondering if anyone met this issue and how it was resolved?

9 Answers

Env:

  • IntelliJ IDEA 2021.1.3 (Ultimate Edition)

Steps:

  • Go to Run configurations combo box.
  • Click Edit Configurations....
  • Check Allow parallel run option.
  • Click OK.

Another note to reduce ambiguity: What was called Run Dashboard in a lot of sources in the past is now called Services.

enter image description here

it's called allow parallel run as of 2018.3 instead of Single instance only

  1. Package the application using mvn package.
  2. Go to the folder where the packaged application jar is stored
  3. Run java -jar [NAME_OF_THE_APPLICATION_JAR] --server.port=[DESIRED_PORT_NUMBER]

OR

  1. Go to the application root directory
  2. Run: mvn spring-boot:run -Drun.arguments="--server.port=[DESIRED_PORT_NUMBER]

That way you can start multiple instances of the same microservice at the same time using different port numbers.

Yes.

Goto "Run configurations" combo box, click "Edit Configurations". Then unchecked "Single instance only" option. Then click "Apply"

For Eureka Server:

1.Run the application without serve.port.

2.Add server.port =9999 in application.properties. Run the application.

Now browse Eureka dashboard, you will have 2 instances running.

Related