Spring Profiles

Sample

@Component
@Profile("dev")
public class DevDatasourceConfig
@Component
@Profile("!dev")
public class DevDatasourceConfig
<beans profile="dev">
    <bean id="devDatasourceConfig"
      class="com.okdevtv.profiles.DevDatasourceConfig" />
</beans>
@Configuration
public class MyWebApplicationInitializer
  implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        servletContext.setInitParameter("spring.profiles.active", "dev");
    }
}
@Autowired
private ConfigurableEnvironment env;
// ...
env.setActiveProfiles("someProfile");
-Dspring.profiles.active=dev
export spring_profiles_active=dev
@ActiveProfiles("dev")

ref

What Else?