Allow refresh auto config to be disabled by property.
fixes gh-276
This commit is contained in:
@@ -9,10 +9,8 @@ import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -26,8 +24,16 @@ public class RefreshAutoConfigurationTests {
|
||||
public void noWarnings() {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(
|
||||
Config.class)) {
|
||||
assertTrue(context.containsBean("refreshScope"));
|
||||
assertThat(output.toString(), not(containsString("WARN")));
|
||||
assertThat(context.containsBean("refreshScope")).isTrue();
|
||||
assertThat(output.toString()).doesNotContain("WARN");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void disabled() {
|
||||
try (ConfigurableApplicationContext context = getApplicationContext(
|
||||
Config.class, "spring.cloud.refresh.enabled:false")) {
|
||||
assertThat(context.containsBean("refreshScope")).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user