Example usage for org.springframework.core.io DefaultResourceLoader DefaultResourceLoader

List of usage examples for org.springframework.core.io DefaultResourceLoader DefaultResourceLoader

Introduction

In this page you can find the example usage for org.springframework.core.io DefaultResourceLoader DefaultResourceLoader.

Prototype

public DefaultResourceLoader(@Nullable ClassLoader classLoader) 

Source Link

Document

Create a new DefaultResourceLoader.

Usage

From source file:org.springframework.boot.SpringApplication.java

private Banner selectBanner(Environment environment) {
    String location = environment.getProperty("banner.location", "banner.txt");
    ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader
            : new DefaultResourceLoader(getClassLoader());
    Resource resource = resourceLoader.getResource(location);

    if (resource.exists()) {
        return new ResourceBanner(resource);
    }//  www . j  a va  2 s . c o  m
    if (this.banner != null) {
        return this.banner;
    }
    return DEFAULT_BANNER;
}

From source file:org.springframework.core.io.support.PathMatchingResourcePatternResolver.java

/**
 * Create a new PathMatchingResourcePatternResolver with a DefaultResourceLoader.
 * @param classLoader the ClassLoader to load classpath resources with,
 * or {@code null} for using the thread context class loader
 * at the time of actual resource access
 * @see org.springframework.core.io.DefaultResourceLoader
 *///  w ww .  j av a2 s  .  c  om
public PathMatchingResourcePatternResolver(@Nullable ClassLoader classLoader) {
    this.resourceLoader = new DefaultResourceLoader(classLoader);
}

From source file:stroom.util.config.StroomProperties.java

private synchronized static void doInit() {
    if (!doneInit) {
        doneInit = true;/*ww w .  j  a  v a 2 s  .  c  o m*/

        final DefaultResourceLoader resourceLoader = new DefaultResourceLoader(
                StroomProperties.class.getClassLoader());

        // Started up as a WAR file?
        final String warName = ServletContextUtil
                .getWARName(UpgradeDispatcherSingleton.instance().getServletConfig());
        if (warName != null) {
            loadResource(resourceLoader, "classpath:/" + warName + ".properties", Source.WAR);
        }

        // Get properties for the current user if there are any.
        loadResource(resourceLoader, "file:" + System.getProperty("user.home") + "/" + USER_CONF_PATH,
                Source.USER_CONF);
        ensureStroomTempEstablished();
    }
}