Spring Profiles
Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any
@Component
or @Configuration
can be marked with @Profile
to limit when it is loaded:@Configuration @Profile("production") public class ProductionConfiguration { // ... }
In the normal Spring way, you can use a
spring.profiles.active
Environment
property to specify which profiles are active. You can specify the property in any of the usual ways, for example you could include it in your application.properties
:spring.profiles.active=dev,hsqldb
or specify on the command line using the switch
--spring.profiles.active=dev,hsqldb
.
No comments:
Post a Comment