Ho to use a profile with spring-boot:run

Published on 06/18/2024

This is a pill article for keeping memory of a Spring Boot option to use with Maven.

Using task spring-boot:run it is possible to run a Spring Boot application with Maven in a quick way.

Sometimes we want to run the application with a particular Spring profile or a set of profiles.

We have to use the following JVM argument: spring-boot.run.profiles

A realistic complete example

mvn spring-boot:run -Dspring-boot.run.profiles={profile_name}

or if you want to run with multiple profiles

mvn spring-boot:run -Dspring-boot.run.profiles=profile1,profile2
  • Article is published under CC-BY 4.0
  • If not explicitly declared code snippets are published under MIT license