Guest User

Untitled

a guest
Oct 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public AbstractConfig() {
  2. super(DataConfig.MGR_NAME);
  3. }
  4.  
  5. public final String MGR_NAME = "theManager";
  6.  
  7. @Value("#PROFILE['AlternateManager'] ? 'theManagerAlt' : 'theManager' ")
  8. public final String MGR_NAME;
  9.  
  10. @Value("#{PROFILE['AlternateManager'] ?: 'theManager' }")
  11. public final String MGR_NAME;
  12.  
  13. @Configuration
  14. public class ExampleConfiguration {
  15.  
  16. // If AlternateManager profile is enabled, Spring Bean will be initialized with "theManagerAlt"
  17. @Bean
  18. @Profile("AlternateManager")
  19. public AbstractConfig getDevDataSource() {
  20. return new AbstractConfig("theManagerAlt");
  21. }
  22.  
  23. // if AlternateManager profile is not enabled, Spring Bean will be initialized with "theManager"
  24. @Bean
  25. @Profile("!AlternateManager")
  26. public AbstractConfig getProdDataSource() {
  27. return new AbstractConfig("theManager");
  28. }
  29. }
Add Comment
Please, Sign In to add comment