Code example for ResourcePropertySource

Methods: getProperty

0
     * This enables overriding the env-${envTarget}.properties location, which is by default resolved internally from the classpath. The entire purpose of overriding this specific properties file is to be able to control 
     * the active Spring profile without defining system wide variables on the OS that runs staging 
     */ 
    private final String getTargetFromOverride() {
        try { 
            final ResourcePropertySource overrideProperties = new ResourcePropertySource("file:///opt/override/overrides.properties");
            return (String) overrideProperties.getProperty(ENV_TARGET);
        } catch (final IOException e) {
            logger.trace("The file overrides.properties is not accessible. No property overridden by external properties"); 
        } 
 
        return null; 
    } 
 
}