Guest User

Untitled

a guest
Feb 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. package foo.bar;
  2.  
  3. import org.springframework.context.ApplicationContextInitializer;
  4. import org.springframework.context.ConfigurableApplicationContext;
  5. import org.springframework.core.env.ConfigurableEnvironment;
  6.  
  7. public class MyContextInitializer implements
  8. ApplicationContextInitializer<ConfigurableApplicationContext> {
  9.  
  10. private static final String PROP = "com.google.appengine.runtime.environment";
  11.  
  12. public void initialize(ConfigurableApplicationContext applicationContext) {
  13. ConfigurableEnvironment springEnvironment = applicationContext.getEnvironment();
  14. String appengine_property = System.getProperty(PROP);
  15. if ("Production".equals(appengine_property))
  16. springEnvironment.setActiveProfiles("production");
  17. else
  18. springEnvironment.setActiveProfiles("local");
  19. }
  20. }
Add Comment
Please, Sign In to add comment