How to Activate a Spring Boot Profile (dev) via Program Arguments, Environment Variables, and Maven
This article demonstrates five practical ways to set the Spring Boot active profile to "dev"—using program arguments, the IDE's Active Profiles field, environment variables, Maven configuration, and Maven with tests skipped—each illustrated with step‑by‑step screenshots.
The author shows several methods to start a Spring Boot application with the dev profile active.
1. Using Program Arguments
Run the application with the JVM argument --spring.profiles.active=dev .
2. Using Active Profiles Configuration
Select dev in the Active Profiles field of the Spring Boot run configuration.
3. Using Environment Variables
Set the environment variable spring.profiles.active=dev before launching the application.
4. Maven Launch with Environment Variables
Configure Maven to pass the same environment variable when building/running.
5. Maven Launch Skipping Tests
Run Maven with -DskipTests while also setting spring.profiles.active=dev .
IT Xianyu
We share common IT technologies (Java, Web, SQL, etc.) and practical applications of emerging software development techniques. New articles are posted daily. Follow IT Xianyu to stay ahead in tech. The IT Xianyu series is being regularly updated.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.