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

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

Introduction

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

Prototype

Resource[] getResources(String locationPattern) throws IOException;

Source Link

Document

Resolve the given location pattern into Resource objects.

Usage

From source file:edu.jhuapl.openessence.config.AppInitializer.java

private void addPropertySources(ConfigurableWebApplicationContext ctx) {
    ConfigurableEnvironment env = ctx.getEnvironment();

    // add properties that don't come from .properties files
    env.getPropertySources().addFirst(getBuiltinPropertySource(ctx));

    try {/*w w  w .java2s . c  o  m*/
        Resource[] classpathPropResources = ctx.getResources("classpath:/config/*.properties");
        for (PropertySource<?> p : getPropertySources(Arrays.asList(classpathPropResources))) {
            env.getPropertySources().addFirst(p);
        }
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
}