[Java Spring] @Profile
For example, inside code, we want production env & dev env print different time format.
@Bean @Profile("!dev") public TimeService timeService(){ return new TimeService(true); } @Bean @Profile("dev") public TimeService timeService12(){ return new TimeService(false); }
Setup VM Options:
-Dspring.profiles.active=prod // or -Dspring.profiles.active=dev