I want my default active profile to be production
if -Dspring.profiles.active
is not set.
I tried the following in my application.properties
but it did't work:
spring.profiles.default=production
Spring-boot version = 1.3.5.RELEASE
The default profile is always active. Spring Boot loads all properties in application. yml into the default profile. We could rename the configuration file to application-default.
The solution would be to create more property files and add the "profile" name as the suffix and configure Spring Boot to pick the appropriate properties based on the profile. Then, we need to create three application. properties : application-dev.
What you are doing here is setting the default default profile (the profile that is used on any bean if you don't specify the @Profile
annotation) to be production
.
What you actually need to do is set the default active profile, which is done like this:
spring.profiles.active=production
add --spring.profiles.active=production
Example:
java -jar file.jar --spring.profiles.active=production
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With