Example usage for org.springframework.core.io.support ResourcePropertySource ResourcePropertySource

List of usage examples for org.springframework.core.io.support ResourcePropertySource ResourcePropertySource

Introduction

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

Prototype

public ResourcePropertySource(String name, String location) throws IOException 

Source Link

Document

Create a PropertySource having the given name based on Properties loaded from the given resource location.

Usage

From source file:io.bitsquare.app.BitsquareEnvironment.java

PropertySource<?> filesystemProperties() throws Exception {
    String location = String.format("file:%s/bitsquare.properties", appDataDir);
    Resource resource = resourceLoader.getResource(location);

    if (!resource.exists())
        return new PropertySource.StubPropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME);

    return new ResourcePropertySource(BITSQUARE_FILESYSTEM_PROPERTY_SOURCE_NAME, resource);
}

From source file:io.bitsquare.app.BitsquareEnvironment.java

PropertySource<?> classpathProperties() throws Exception {
    Resource resource = resourceLoader.getResource("classpath:bitsquare.properties");
    return new ResourcePropertySource(BITSQUARE_CLASSPATH_PROPERTY_SOURCE_NAME, resource);
}