Search in sources :

Example 51 with MutablePropertySources

use of org.springframework.core.env.MutablePropertySources in project spring-boot by spring-projects.

the class EmbeddedLdapAutoConfiguration method setPortProperty.

private void setPortProperty(ApplicationContext context, int port) {
    if (context instanceof ConfigurableApplicationContext) {
        MutablePropertySources sources = ((ConfigurableApplicationContext) context).getEnvironment().getPropertySources();
        getLdapPorts(sources).put("local.ldap.port", port);
    }
    if (context.getParent() != null) {
        setPortProperty(context.getParent(), port);
    }
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) MutablePropertySources(org.springframework.core.env.MutablePropertySources)

Aggregations

MutablePropertySources (org.springframework.core.env.MutablePropertySources)51 Test (org.junit.Test)20 MapPropertySource (org.springframework.core.env.MapPropertySource)12 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)10 PropertiesPropertySource (org.springframework.core.env.PropertiesPropertySource)8 MockPropertySource (org.springframework.mock.env.MockPropertySource)8 Properties (java.util.Properties)6 PropertySourcesPropertyResolver (org.springframework.core.env.PropertySourcesPropertyResolver)6 CompositePropertySource (org.springframework.core.env.CompositePropertySource)5 ByteArrayResource (org.springframework.core.io.ByteArrayResource)4 LinkedHashMap (java.util.LinkedHashMap)3 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)3 RandomValuePropertySource (org.springframework.boot.env.RandomValuePropertySource)3 PropertySource (org.springframework.core.env.PropertySource)3 StandardEnvironment (org.springframework.core.env.StandardEnvironment)3 SystemEnvironmentPropertySource (org.springframework.core.env.SystemEnvironmentPropertySource)3 MockEnvironment (org.springframework.mock.env.MockEnvironment)3 TestBean (org.springframework.tests.sample.beans.TestBean)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2