# Spring profile

# Spring Profiles allows to configure parts available for certain environment

Any @Component or @Configuration could be marked with @Profile annotation

public class ProductionConfiguration {

    // ...

The same in XML config

<beans profile="dev">
    <bean id="dataSource" class="<some data source class>" />

Active profiles could be configured in the application.properties file


or specified from command line


or in SpringBoot


It is possible to enable profiles in Tests using the annotation @ActiveProfiles("dev")