Spring profile
Spring Profiles allows to configure parts available for certain environment
Section titled “Spring Profiles allows to configure parts available for certain environment”Any @Component or @Configuration could be marked with @Profile annotation
@Configuration@Profile("production")public class ProductionConfiguration {
// ...}The same in XML config
<beans profile="dev"> <bean id="dataSource" class="<some data source class>" /></beans>Active profiles could be configured in the application.properties file
spring.profiles.active=dev,productionor specified from command line
--spring.profiles.active=dev,hsqldbor in SpringBoot
SpringApplication.setAdditionalProfiles("dev");It is possible to enable profiles in Tests using the annotation @ActiveProfiles("dev")