Spring Boot 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:

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
or specify on the command line using the switch --spring.profiles.active=dev,hsqldb.


Profile specific configuration files


Leave a Reply

Your email address will not be published.