List of usage examples for org.springframework.boot.context.properties.source ConfigurationPropertySources attach
public static void attach(Environment environment)
From source file:org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfigurationTests.java
private void endpointEnabledOverride(String name, Class<? extends MvcEndpoint> type) throws Exception { this.applicationContext.register(LoggingConfig.class, RootConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class); ConfigurationPropertySources.attach(this.applicationContext.getEnvironment()); EnvironmentTestUtils.addEnvironment(this.applicationContext, "endpoints.enabled:false", String.format("endpoints.%s.enabled:true", name)); this.applicationContext.refresh(); assertThat(this.applicationContext.getBeansOfType(type)).hasSize(1); }
From source file:org.springframework.boot.context.logging.LoggingApplicationListenerTests.java
@Before public void init() throws SecurityException, IOException { LogManager.getLogManager()/* w w w .j a va 2 s.co m*/ .readConfiguration(JavaLoggingSystem.class.getResourceAsStream("logging.properties")); multicastEvent(new ApplicationStartingEvent(new SpringApplication(), NO_ARGS)); new File("target/foo.log").delete(); new File(tmpDir() + "/spring.log").delete(); ConfigurableEnvironment environment = this.context.getEnvironment(); ConfigurationPropertySources.attach(environment); }