Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public AbstractConfig() {
- super(DataConfig.MGR_NAME);
- }
- public final String MGR_NAME = "theManager";
- @Value("#PROFILE['AlternateManager'] ? 'theManagerAlt' : 'theManager' ")
- public final String MGR_NAME;
- @Value("#{PROFILE['AlternateManager'] ?: 'theManager' }")
- public final String MGR_NAME;
- @Configuration
- public class ExampleConfiguration {
- // If AlternateManager profile is enabled, Spring Bean will be initialized with "theManagerAlt"
- @Bean
- @Profile("AlternateManager")
- public AbstractConfig getDevDataSource() {
- return new AbstractConfig("theManagerAlt");
- }
- // if AlternateManager profile is not enabled, Spring Bean will be initialized with "theManager"
- @Bean
- @Profile("!AlternateManager")
- public AbstractConfig getProdDataSource() {
- return new AbstractConfig("theManager");
- }
- }
Add Comment
Please, Sign In to add comment