Spring Framework ResourcePropertySource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ResourcePropertySource class.

This code example shows how to use the following methods:
This code example shows how to use the following methods:getProperty
     * 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; 
    } 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        globalConfig = "/etc/annis";
      } 
      File fGlobal = new File(globalConfig + "/" + configFileName);
      if(fGlobal.canRead() && fGlobal.isFile())
      { 
        sources.addFirst(new ResourcePropertySource("file:" + fBase.getCanonicalPath()));
      } 
       
      String userConfig = System.getProperty("user.home") + "/.annis";
      File fUser = new File(userConfig + "/" + configFileName);
      if(fUser.canRead() && fUser.isFile())
      { 
        sources.addFirst(new ResourcePropertySource("file:" + fUser.getCanonicalPath()));
      } 
       
    } 
    catch (IOException ex)
    { 
      log.error("Could not load configuration", ex);
    } 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
     * thus do not use AnnisXmlContextHelper.prepareContext()!  
     */ 
    MutablePropertySources sources = ctx.getEnvironment().getPropertySources();
    try 
    { 
      sources.addFirst(new ResourcePropertySource("file:" + Utils.getAnnisFile(
        "conf/annis-service-developer.properties").getAbsolutePath())); 
      sources.addFirst(new ResourcePropertySource("file:" + Utils.getAnnisFile(
        "conf/annis-service.properties").getAbsolutePath())); 
    } 
    catch (IOException ex)
    { 
      log.error("Could not load conf/annis-service.properties", ex);
    } 
  } 
 
   
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java