Example usage for org.springframework.core.env StandardEnvironment getSystemProperties

List of usage examples for org.springframework.core.env StandardEnvironment getSystemProperties

Introduction

In this page you can find the example usage for org.springframework.core.env StandardEnvironment getSystemProperties.

Prototype

@Override
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public Map<String, Object> getSystemProperties() 

Source Link

Usage

From source file:org.greencheek.utils.environment.propertyplaceholder.spring.ListBasedMutablePropertySources.java

public static PropertySource getSystemProperties() {
    StandardEnvironment env = new StandardEnvironment();
    return new MapPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME,
            env.getSystemProperties());
}

From source file:org.greencheek.utils.environment.propertyplaceholder.spring.EnvironmentalPropertySourcesPlaceholderConfigurerWithSpringValueResolution.java

@Override
public void afterPropertiesSet() {
    if (mergerBuilder == null) {
        throw new IllegalStateException("The PropertyMergerBuilder must not be null.");
    }/*from  w w  w. j  a va 2 s .c o m*/

    Properties p = mergerBuilder.build().getMergedProperties();

    StandardEnvironment env = new StandardEnvironment();
    MutablePropertySources sources = new MutablePropertySources();

    if (isSystemPropertiesResolutionEnabled())
        sources.addLast(new MapPropertySource(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME,
                env.getSystemProperties()));
    if (isEnvironmentPropertiesResolutionEnabled())
        sources.addLast(new SystemEnvironmentPropertySource(
                StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, env.getSystemEnvironment()));

    sources.addFirst(new PropertiesPropertySource(ENVIRONMENT_SPECIFIC_PROPERTIES, p));
    super.setPropertySources(sources);
}