List of usage examples for org.springframework.core.env StandardEnvironment SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
String SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME
To view the source code for org.springframework.core.env StandardEnvironment SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME.
Click Source Link
From source file:org.greencheek.utils.environment.propertyplaceholder.spring.ListBasedMutablePropertySources.java
public static PropertySource getSystemEnvironmentProperties() { StandardEnvironment env = new StandardEnvironment(); return new SystemEnvironmentPropertySource(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, env.getSystemEnvironment()); }
From source file:io.jmnarloch.spring.cloud.discovery.DiscoveryClientPropertySourceConfigurer.java
/** * Configures the property sources//from w ww .j a v a 2 s.co m * * @param environment the application environment */ protected void configurePropertySources(ConfigurableEnvironment environment) { environment.getPropertySources().addAfter(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, new DiscoveryClientPropertySource("discoveryClient")); }
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.ja va2 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); }
From source file:nl.nn.adapterframework.configuration.IbisContext.java
/** * Create Spring Bean factory. Parameter 'springContext' can be null. * * Create the Spring Bean Factory using the supplied <code>springContext</code>, * if not <code>null</code>. * * @param springContext Spring Context to create. If <code>null</code>, * use the default spring context./*from www . j a v a2 s .c o m*/ * The spring context is loaded as a spring ClassPathResource from * the class path. * * @return The Spring XML Bean Factory. * @throws BeansException If the Factory can not be created. * */ private ApplicationContext createApplicationContext() throws BeansException { // Reading in Spring Context long start = System.currentTimeMillis(); String springContext = "/springContext.xml"; ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(); MutablePropertySources propertySources = applicationContext.getEnvironment().getPropertySources(); propertySources.remove(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME); propertySources.remove(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); propertySources.addFirst(new PropertiesPropertySource("ibis", APP_CONSTANTS)); applicationContext.setConfigLocation(springContext); applicationContext.refresh(); log("startup " + springContext + " in " + (System.currentTimeMillis() - start) + " ms"); return applicationContext; }
From source file:org.finra.dm.core.AbstractCoreTest.java
@Before public void setup() throws Exception { // Remove the system environment property source so system environment variables don't affect unit tests. getMutablePropertySources().remove(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME); }
From source file:org.metaeffekt.dcc.commons.mapping.AbstractPropertyExpression.java
@SuppressWarnings("unchecked") protected <T> T evaluateExpression(String originalExpression, String value, Class<T> type) { final ExpressionParser parser = new SpelExpressionParser(); try {/*from w w w . j a v a 2s.c om*/ final StandardEvaluationContext context = new StandardEvaluationContext(); context.setRootObject(propertiesHolder); context.addPropertyAccessor(new EnvironmentAccessor()); context.setVariable(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, STANDARD_ENVIRONMENT); context.setVariable(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, STANDARD_ENVIRONMENT); final Expression expression = parser.parseExpression(value, PARSER_CONTEXT); return expression.getValue(context, type); } catch (ParseException | EvaluationException e) { LOG.debug(String.format("Failed to evaluate expression %s, and with replaced properties %s", originalExpression, value), e); } if (type == String.class) { return (T) value; } return null; }
From source file:org.springframework.boot.context.config.RandomValuePropertySource.java
public static void addToEnvironment(ConfigurableEnvironment environment) { environment.getPropertySources().addAfter(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, new RandomValuePropertySource("random")); logger.trace("RandomValuePropertySource add to Environment"); }
From source file:org.springframework.boot.env.RandomValuePropertySource.java
public static void addToEnvironment(ConfigurableEnvironment environment) { environment.getPropertySources().addAfter(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, new RandomValuePropertySource(RANDOM_PROPERTY_SOURCE_NAME)); logger.trace("RandomValuePropertySource add to Environment"); }