Subversion Repositories SmartDukaan

Rev

Rev 35830 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35830 Rev 35832
Line 110... Line 110...
110
    @Bean
110
    @Bean
111
    public static PropertySourcesPlaceholderConfigurer propertyConfigurer1() {
111
    public static PropertySourcesPlaceholderConfigurer propertyConfigurer1() {
112
        LOGGER.info("Called Configuration");
112
        LOGGER.info("Called Configuration");
113
        PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
113
        PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
114
 
114
 
-
 
115
        String activeProfile;
-
 
116
        Properties properties = new Properties();
-
 
117
        try {
115
        Resource appResource = new ClassPathResource("/META-INF/env.properties");
118
            properties.load(Application.class.getClassLoader().getResourceAsStream("META-INF/env.property"));
-
 
119
        } catch (IOException e) {
-
 
120
            LOGGER.error("Error reading env.property, defaulting to dev: " + e);
-
 
121
            properties.put("profile", "dev");
-
 
122
        }
-
 
123
        activeProfile = (String) properties.get("profile");
116
 
124
 
-
 
125
        Resource appResource;
-
 
126
        Resource sharedResource;
-
 
127
 
-
 
128
        if ("prod".equals(activeProfile)) {
-
 
129
            appResource = new ClassPathResource("/META-INF/prod.properties");
-
 
130
            sharedResource = new ClassPathResource("/shared-prod.properties");
-
 
131
        } else if ("staging".equals(activeProfile)) {
-
 
132
            appResource = new ClassPathResource("/META-INF/staging.properties");
-
 
133
            sharedResource = new ClassPathResource("/shared-staging.properties");
-
 
134
        } else {
-
 
135
            appResource = new ClassPathResource("/META-INF/dev.properties");
-
 
136
            sharedResource = new ClassPathResource("/shared-dev.properties");
-
 
137
        }
-
 
138
 
-
 
139
        LOGGER.info("Cron loading profile: " + activeProfile);
117
        propertySourcesPlaceholderConfigurer.setLocations(appResource);
140
        propertySourcesPlaceholderConfigurer.setLocations(sharedResource, appResource);
118
        propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
141
        propertySourcesPlaceholderConfigurer.setIgnoreResourceNotFound(true);
119
 
142
 
120
        return propertySourcesPlaceholderConfigurer;
143
        return propertySourcesPlaceholderConfigurer;
121
    }
144
    }
122
 
145