Backend Development 3 min read

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.

IT Xianyu
IT Xianyu
IT Xianyu
How to Activate a Spring Boot Profile (dev) via Program Arguments, Environment Variables, and Maven

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 .

JavaconfigurationmavenSpring Bootprofile
IT Xianyu
Written by

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.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.