spring.profiles.active
is one of the properties that Spring Boot applications support out of the box. Its used to specify at the level of Spring Boot application which profiles should be run.
Spring Boot supports many different properties, a full list can be found here.
Now, you won't find run.profiles
among these properties, because its just a property that Spring Boot Maven plugin supports (and yes, it 'translates' it to the list of profiles to be used as well, so these properties might look similar), but the point is that -Drun.profiles
will only work if you start the spring boot application with Maven plugin.
In production, however, the chances are that there won't be Maven at all, and the application will run as is (as a big jar) or even packed as Docker image or something. So for non maven-plugin usage you should use spring.profiles.active
The last point, that even in Maven --spring.profiles.active
can be used, but it doesn't work out of the box. You should pass this parameter like this:
mvn spring-boot:run -Drun.jvmArguments="-Dspring.profiles.active=production"
See this item in Github.
Hope this clarifies the differences between the two.