Example usage for org.springframework.web.context ConfigurableWebApplicationContext getResource

List of usage examples for org.springframework.web.context ConfigurableWebApplicationContext getResource

Introduction

In this page you can find the example usage for org.springframework.web.context ConfigurableWebApplicationContext getResource.

Prototype

Resource getResource(String location);

Source Link

Document

Return a Resource handle for the specified resource location.

Usage

From source file:org.cloudfoundry.identity.uaa.config.YamlServletProfileInitializer.java

private Resource getResource(ServletContext servletContext,
        ConfigurableWebApplicationContext applicationContext, String locations) {
    Resource resource = null;/* w  w w  . j av  a2  s . c o  m*/
    String[] configFileLocations = locations == null ? DEFAULT_PROFILE_CONFIG_FILE_LOCATIONS
            : StringUtils.commaDelimitedListToStringArray(locations);
    for (String location : configFileLocations) {
        location = applicationContext.getEnvironment().resolvePlaceholders(location);
        servletContext.log("Testing for YAML resources at: " + location);
        resource = applicationContext.getResource(location);
        if (resource != null && resource.exists()) {
            break;
        }
    }
    return resource;
}