SpringBoot Profile
Setting a profile
- Using
-Dspring.profiles.active=prod
in VM Arguments - In application.properties,
spring.profiles.active=prod
@Profile
- making a profile active from the application.properties
-
default profile is added with the argument
-
@Profile({"qa","default"})
on a bean
-
@Profile({"qa","default"})
@Bean
public String beanQa() {
return "Qa";
}
@Profile("prod")
@Bean
public String beanProd() {
return "profile prod";
}