Search in sources :

Example 11 with PropertySource

use of org.springframework.core.env.PropertySource in project bitsquare by bitsquare.

the class BitsquareEnvironment method homeDirProperties.

private PropertySource<?> homeDirProperties() throws Exception {
    String location = String.format("file:%s/.bitsquare/bitsquare.properties", getProperty("user.home"));
    Resource resource = resourceLoader.getResource(location);
    if (!resource.exists())
        return new PropertySource.StubPropertySource(BITSQUARE_HOME_DIR_PROPERTY_SOURCE_NAME);
    return new ResourcePropertySource(BITSQUARE_HOME_DIR_PROPERTY_SOURCE_NAME, resource);
}
Also used : ResourcePropertySource(org.springframework.core.io.support.ResourcePropertySource) Resource(org.springframework.core.io.Resource) PropertySource(org.springframework.core.env.PropertySource) ResourcePropertySource(org.springframework.core.io.support.ResourcePropertySource) PropertiesPropertySource(org.springframework.core.env.PropertiesPropertySource) JOptCommandLinePropertySource(io.bitsquare.util.spring.JOptCommandLinePropertySource)

Aggregations

PropertySource (org.springframework.core.env.PropertySource)11 EnumerablePropertySource (org.springframework.core.env.EnumerablePropertySource)5 CompositePropertySource (org.springframework.core.env.CompositePropertySource)4 LinkedHashMap (java.util.LinkedHashMap)3 MutablePropertySources (org.springframework.core.env.MutablePropertySources)3 Environment (grails.util.Environment)2 Test (org.junit.Test)2 PropertiesPropertySource (org.springframework.core.env.PropertiesPropertySource)2 Resource (org.springframework.core.io.Resource)2 MockPropertySource (org.springframework.mock.env.MockPropertySource)2 BitsquareEnvironment (io.bitsquare.app.BitsquareEnvironment)1 JOptCommandLinePropertySource (io.bitsquare.util.spring.JOptCommandLinePropertySource)1 File (java.io.File)1 Reader (java.io.Reader)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Files (java.nio.file.Files)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Comparator (java.util.Comparator)1