Moves declaration of EnvironmentManager
fixes gh-314
This commit is contained in:
@@ -37,7 +37,7 @@ public class LifecycleMvcAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void postEnvMvcEndpointEnabled() {
|
||||
beanCreated("environmentManagerEndpoint",
|
||||
beanCreated("environmentManagerMvcEndpoint",
|
||||
"endpoints.env.post.enabled=true");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class RefreshAutoConfigurationTests {
|
||||
@Test
|
||||
public void noWarnings() {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(
|
||||
Config.class)) {
|
||||
false, Config.class)) {
|
||||
assertThat(context.containsBean("refreshScope")).isTrue();
|
||||
assertThat(output.toString()).doesNotContain("WARN");
|
||||
}
|
||||
@@ -32,14 +32,14 @@ public class RefreshAutoConfigurationTests {
|
||||
@Test
|
||||
public void disabled() {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(
|
||||
Config.class, "spring.cloud.refresh.enabled:false")) {
|
||||
true, Config.class, "spring.cloud.refresh.enabled:false")) {
|
||||
assertThat(context.containsBean("refreshScope")).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
private static ConfigurableApplicationContext getApplicationContext(
|
||||
Class<?> configuration, String... properties) {
|
||||
return new SpringApplicationBuilder(configuration).web(false).properties(properties).run();
|
||||
boolean web, Class<?> configuration, String... properties) {
|
||||
return new SpringApplicationBuilder(configuration).web(web).properties(properties).run();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.junit.rules.ExpectedException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.cloud.autoconfigure.LifecycleMvcEndpointAutoConfiguration;
|
||||
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.cloud.context.environment.EnvironmentManager;
|
||||
@@ -65,7 +66,7 @@ public class RefreshScopeConfigurationTests {
|
||||
@Test
|
||||
public void configurationWithRefreshScope() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext(Application.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class);
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class, LifecycleMvcEndpointAutoConfiguration.class);
|
||||
Application application = context.getBean(Application.class);
|
||||
assertEquals("refresh", context.getBeanDefinition("scopedTarget.application").getScope());
|
||||
application.hello();
|
||||
@@ -77,7 +78,7 @@ public class RefreshScopeConfigurationTests {
|
||||
@Test
|
||||
public void refreshScopeOnBean() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext(ClientApp.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class);
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class, LifecycleMvcEndpointAutoConfiguration.class);
|
||||
Controller application = context.getBean(Controller.class);
|
||||
application.hello();
|
||||
refresh();
|
||||
@@ -88,7 +89,7 @@ public class RefreshScopeConfigurationTests {
|
||||
@Test
|
||||
public void refreshScopeOnNested() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext(NestedApp.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class);
|
||||
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class, LifecycleMvcEndpointAutoConfiguration.class);
|
||||
NestedController application = context.getBean(NestedController.class);
|
||||
application.hello();
|
||||
refresh();
|
||||
|
||||
Reference in New Issue
Block a user