Restores bootstrap functionality.

This commit is contained in:
spencergibb
2022-01-20 11:47:53 -05:00
parent e335b1245b
commit 0d7722dec8
19 changed files with 1041 additions and 66 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.test.context.ActiveProfiles;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = Application.class,
properties = { "encrypt.key:deadbeef", "spring.config.use-legacy-processing=true" })
properties = { "encrypt.key:deadbeef", "spring.cloud.bootstrap.enabled=true" })
@ActiveProfiles("encrypt")
public class BootstrapOrderingAutoConfigurationIntegrationTests {

View File

@@ -39,7 +39,7 @@ import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(classes = Application.class,
properties = { "spring.config.use-legacy-processing=true", "spring.cloud.bootstrap.name:ordering" })
properties = { "spring.cloud.bootstrap.enabled=true", "spring.cloud.bootstrap.name:ordering" })
public class BootstrapOrderingCustomOverrideSystemPropertiesIntegrationTests {
@Autowired

View File

@@ -37,7 +37,7 @@ import org.springframework.test.context.ActiveProfiles;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = Application.class, properties = { "encrypt.key:deadbeef",
"spring.cloud.bootstrap.name:custom", "spring.config.use-legacy-processing=true" })
"spring.cloud.bootstrap.name:custom", "spring.cloud.bootstrap.enabled=true" })
@ActiveProfiles("encrypt")
public class BootstrapOrderingCustomPropertySourceIntegrationTests {

View File

@@ -26,7 +26,7 @@ import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.BDDAssertions.then;
import static org.springframework.cloud.bootstrap.TestHigherPriorityBootstrapConfiguration.firstToBeCreated;
@SpringBootTest(classes = Application.class, properties = "spring.config.use-legacy-processing=true")
@SpringBootTest(classes = Application.class, properties = "spring.cloud.bootstrap.enabled=true")
public class BootstrapSourcesOrderingTests {
@Test

View File

@@ -80,7 +80,7 @@ public class BootstrapConfigurationTests {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.location=" + externalPropertiesPath,
"spring.config.use-legacy-processing=true")
"spring.cloud.bootstrap.enabled=true")
.run();
then(this.context.getEnvironment().getProperty("info.name")).isEqualTo("externalPropertiesInfoName");
then(this.context.getEnvironment().getProperty("info.desc")).isNull();
@@ -95,7 +95,7 @@ public class BootstrapConfigurationTests {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.additional-location=" + externalPropertiesPath,
"spring.config.use-legacy-processing=true")
"spring.cloud.bootstrap.enabled=true")
.run();
then(this.context.getEnvironment().getProperty("info.name")).isEqualTo("externalPropertiesInfoName");
then(this.context.getEnvironment().getProperty("info.desc")).isEqualTo("defaultPropertiesInfoDesc");
@@ -107,7 +107,7 @@ public class BootstrapConfigurationTests {
@Test
public void bootstrapPropertiesAvailableInInitializer() {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class)
.initializers(new ApplicationContextInitializer<ConfigurableApplicationContext>() {
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
@@ -134,7 +134,7 @@ public class BootstrapConfigurationTests {
public void picksUpAdditionalPropertySource() {
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("bar");
then(this.context.getEnvironment().getPropertySources()
.contains(PropertySourceBootstrapConfiguration.BOOTSTRAP_PROPERTY_SOURCE_NAME + "-testBootstrap"))
@@ -146,7 +146,7 @@ public class BootstrapConfigurationTests {
System.setProperty("expected.fail", "true");
Throwable throwable = Assertions.assertThrows(RuntimeException.class, () -> {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
});
then(throwable.getMessage().equals("Planned"));
}
@@ -156,7 +156,7 @@ public class BootstrapConfigurationTests {
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
System.setProperty("bootstrap.foo", "system");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("bar");
}
@@ -166,7 +166,7 @@ public class BootstrapConfigurationTests {
PropertySourceConfiguration.MAP.put("spring.cloud.config.overrideSystemProperties", "false");
System.setProperty("bootstrap.foo", "system");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("system");
}
@@ -180,7 +180,7 @@ public class BootstrapConfigurationTests {
PropertySourceConfiguration.MAP.put("spring.cloud.config.allowOverride", "false");
System.setProperty("bootstrap.foo", "system");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("bar");
}
@@ -191,7 +191,7 @@ public class BootstrapConfigurationTests {
PropertySourceConfiguration.MAP.put("spring.cloud.config.allowOverride", "true");
System.setProperty("bootstrap.foo", "system");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class).run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("system");
}
@@ -204,7 +204,7 @@ public class BootstrapConfigurationTests {
environment.getPropertySources().addLast(
new MapPropertySource("last", Collections.<String, Object>singletonMap("bootstrap.foo", "splat")));
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").environment(environment)
.properties("spring.cloud.bootstrap.enabled=true").environment(environment)
.sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("splat");
}
@@ -214,7 +214,7 @@ public class BootstrapConfigurationTests {
System.setProperty("expected.name", "main");
this.context = new SpringApplicationBuilder()
.web(WebApplicationType.NONE).properties("spring.cloud.bootstrap.name:other",
"spring.config.use-legacy-processing=true", "spring.config.name:plain")
"spring.cloud.bootstrap.enabled=true", "spring.config.name:plain")
.sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("spring.application.name")).isEqualTo("app");
// The parent is called "main" because spring.application.name is specified in
@@ -231,7 +231,7 @@ public class BootstrapConfigurationTests {
System.setProperty("expected.name", "main");
this.context = new SpringApplicationBuilder()
.web(WebApplicationType.NONE).properties("spring.cloud.bootstrap.name:application",
"spring.config.use-legacy-processing=true", "spring.config.name:other")
"spring.cloud.bootstrap.enabled=true", "spring.config.name:other")
.sources(BareConfiguration.class).run();
then(this.context.getEnvironment().getProperty("spring.application.name")).isEqualTo("main");
// The parent has no name because spring.application.name is not
@@ -243,7 +243,7 @@ public class BootstrapConfigurationTests {
public void applicationNameOnlyInBootstrap() {
System.setProperty("expected.name", "main");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.cloud.bootstrap.name:other", "spring.config.use-legacy-processing=true")
.properties("spring.cloud.bootstrap.name:other", "spring.cloud.bootstrap.enabled=true")
.sources(BareConfiguration.class).run();
// The main context is called "main" because spring.application.name is specified
// in other.properties (and not in the main config file)
@@ -258,7 +258,7 @@ public class BootstrapConfigurationTests {
public void environmentEnrichedOnceWhenSharedWithChildContext() {
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
this.context = new SpringApplicationBuilder().sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true").environment(new StandardEnvironment())
.properties("spring.cloud.bootstrap.enabled=true").environment(new StandardEnvironment())
.child(BareConfiguration.class).web(WebApplicationType.NONE).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("bar");
then(this.context.getParent().getEnvironment()).isEqualTo(this.context.getEnvironment());
@@ -274,7 +274,7 @@ public class BootstrapConfigurationTests {
TestHigherPriorityBootstrapConfiguration.count.set(0);
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
this.context = new SpringApplicationBuilder().sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true").child(BareConfiguration.class)
.properties("spring.cloud.bootstrap.enabled=true").child(BareConfiguration.class)
.web(WebApplicationType.NONE).run();
then(TestHigherPriorityBootstrapConfiguration.count.get()).isEqualTo(1);
then(this.context.getParent()).isNotNull();
@@ -286,7 +286,7 @@ public class BootstrapConfigurationTests {
@Test
public void listOverride() {
this.context = new SpringApplicationBuilder().sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true").child(BareConfiguration.class)
.properties("spring.cloud.bootstrap.enabled=true").child(BareConfiguration.class)
.web(WebApplicationType.NONE).run();
ListProperties listProperties = new ListProperties();
Binder.get(this.context.getEnvironment()).bind("list", Bindable.ofInstance(listProperties));
@@ -299,7 +299,7 @@ public class BootstrapConfigurationTests {
TestHigherPriorityBootstrapConfiguration.count.set(0);
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
SpringApplicationBuilder builder = new SpringApplicationBuilder()
.properties("spring.config.use-legacy-processing=true").sources(BareConfiguration.class);
.properties("spring.cloud.bootstrap.enabled=true").sources(BareConfiguration.class);
this.sibling = builder.child(BareConfiguration.class).properties("spring.application.name=sibling")
.web(WebApplicationType.NONE).run();
this.context = builder.child(BareConfiguration.class).properties("spring.application.name=context")
@@ -321,7 +321,7 @@ public class BootstrapConfigurationTests {
public void environmentEnrichedInParentContext() {
PropertySourceConfiguration.MAP.put("bootstrap.foo", "bar");
this.context = new SpringApplicationBuilder().sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true").child(BareConfiguration.class)
.properties("spring.cloud.bootstrap.enabled=true").child(BareConfiguration.class)
.web(WebApplicationType.NONE).run();
then(this.context.getEnvironment().getProperty("bootstrap.foo")).isEqualTo("bar");
then(this.context.getParent().getEnvironment()).isNotSameAs(this.context.getEnvironment());
@@ -341,7 +341,7 @@ public class BootstrapConfigurationTests {
ConfigurableApplicationContext parent = new SpringApplicationBuilder().sources(BareConfiguration.class)
.profiles("parent").web(WebApplicationType.NONE).run();
this.context = new SpringApplicationBuilder(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true").profiles("child").parent(parent)
.properties("spring.cloud.bootstrap.enabled=true").profiles("child").parent(parent)
.web(WebApplicationType.NONE).run();
then(this.context.getParent().getEnvironment()).isNotSameAs(this.context.getEnvironment());
// The ApplicationContext merges profiles (profiles and property sources), see
@@ -367,7 +367,7 @@ public class BootstrapConfigurationTests {
public void includeProfileFromBootstrapPropertySource() {
PropertySourceConfiguration.MAP.put("spring.profiles.include", "bar,baz");
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE)
.properties("spring.config.use-legacy-processing=true").profiles("foo").sources(BareConfiguration.class)
.properties("spring.cloud.bootstrap.enabled=true").profiles("foo").sources(BareConfiguration.class)
.run();
then(this.context.getEnvironment().acceptsProfiles("baz")).isTrue();
then(this.context.getEnvironment().acceptsProfiles("bar")).isTrue();
@@ -376,7 +376,7 @@ public class BootstrapConfigurationTests {
@Test
public void includeProfileFromBootstrapProperties() {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.bootstrap.name=local").run();
.properties("spring.cloud.bootstrap.enabled=true", "spring.cloud.bootstrap.name=local").run();
then(this.context.getEnvironment().acceptsProfiles("local")).isTrue();
then(this.context.getEnvironment().getProperty("added")).isEqualTo("Hello added!");
}
@@ -384,8 +384,7 @@ public class BootstrapConfigurationTests {
@Test
public void nonEnumerablePropertySourceWorks() {
this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(BareConfiguration.class)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.bootstrap.name=nonenumerable")
.run();
.properties("spring.cloud.bootstrap.enabled=true", "spring.cloud.bootstrap.name=nonenumerable").run();
then(this.context.getEnvironment().getProperty("foo")).isEqualTo("bar");
}

View File

@@ -37,8 +37,7 @@ public class BootstrapListenerHierarchyIntegrationTests {
@Test
public void shouldAddInABootstrapContext() {
ConfigurableApplicationContext context = new SpringApplicationBuilder()
.properties("spring.config.use-legacy-processing=true").sources(BasicConfiguration.class).web(NONE)
.run();
.properties("spring.cloud.bootstrap.enabled=true").sources(BasicConfiguration.class).web(NONE).run();
then(context.getParent()).isNotNull();
}
@@ -46,7 +45,7 @@ public class BootstrapListenerHierarchyIntegrationTests {
@Test
public void shouldAddInOneBootstrapForABasicParentChildHierarchy() {
ConfigurableApplicationContext context = new SpringApplicationBuilder()
.properties("spring.config.use-legacy-processing=true").sources(RootConfiguration.class).web(NONE)
.properties("spring.cloud.bootstrap.enabled=true").sources(RootConfiguration.class).web(NONE)
.child(BasicConfiguration.class).web(NONE).run();
// Should be RootConfiguration based context
@@ -65,7 +64,7 @@ public class BootstrapListenerHierarchyIntegrationTests {
@Test
public void shouldAddInOneBootstrapForSiblingsBasedHierarchy() {
ConfigurableApplicationContext context = new SpringApplicationBuilder()
.properties("spring.config.use-legacy-processing=true").sources(RootConfiguration.class).web(NONE)
.properties("spring.cloud.bootstrap.enabled=true").sources(RootConfiguration.class).web(NONE)
.child(BasicConfiguration.class).web(NONE).sibling(BasicConfiguration.class).web(NONE).run();
// Should be RootConfiguration based context

View File

@@ -39,7 +39,7 @@ public class EncryptionIntegrationTests {
@Test
public void legacySymmetricPropertyValues() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(TestConfiguration.class)
.web(WebApplicationType.NONE).properties("spring.config.use-legacy-processing=true", "encrypt.key:pie",
.web(WebApplicationType.NONE).properties("spring.cloud.bootstrap.enabled=true", "encrypt.key:pie",
"foo.password:{cipher}bf29452295df354e6153c5b31b03ef23c70e55fba24299aa85c63438f1c43c95")
.run();
then(context.getEnvironment().getProperty("foo.password")).isEqualTo("test");
@@ -48,7 +48,7 @@ public class EncryptionIntegrationTests {
@Test
public void legacySymmetricConfigurationProperties() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(TestConfiguration.class)
.web(WebApplicationType.NONE).properties("spring.config.use-legacy-processing=true", "encrypt.key:pie",
.web(WebApplicationType.NONE).properties("spring.cloud.bootstrap.enabled=true", "encrypt.key:pie",
"foo.password:{cipher}bf29452295df354e6153c5b31b03ef23c70e55fba24299aa85c63438f1c43c95")
.run();
then(context.getBean(PasswordProperties.class).getPassword()).isEqualTo("test");

View File

@@ -40,7 +40,7 @@ import org.springframework.test.context.ActiveProfiles;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = TestConfiguration.class, properties = "spring.config.use-legacy-processing=true")
@SpringBootTest(classes = TestConfiguration.class, properties = "spring.cloud.bootstrap.enabled=true")
@ActiveProfiles("config")
public class ConfigurationPropertiesRebinderIntegrationTests {

View File

@@ -37,7 +37,7 @@ import org.springframework.test.annotation.DirtiesContext;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = TestConfiguration.class, properties = "spring.config.use-legacy-processing=true")
@SpringBootTest(classes = TestConfiguration.class, properties = "spring.cloud.bootstrap.enabled=true")
public class ConfigurationPropertiesRebinderRefreshScopeIntegrationTests {
@Autowired

View File

@@ -34,7 +34,7 @@ import org.springframework.test.annotation.DirtiesContext;
import static org.assertj.core.api.BDDAssertions.then;
@SpringBootTest(classes = TestConfiguration.class,
properties = { "spring.datasource.hikari.read-only=false", "spring.config.use-legacy-processing=true" })
properties = { "spring.datasource.hikari.read-only=false", "spring.cloud.bootstrap.enabled=true" })
public class ContextRefresherIntegrationTests {
@Autowired

View File

@@ -41,7 +41,7 @@ import org.springframework.test.annotation.DirtiesContext;
import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(properties = "spring.config.use-legacy-processing=true")
@SpringBootTest(properties = "spring.cloud.bootstrap.enabled=true")
@DirtiesContext
public class ContextRefresherOrderingIntegrationTests {

View File

@@ -62,8 +62,8 @@ public class ContextRefresherTests {
@Disabled // FIXME: legacy config
public void orderNewPropertiesConsistentWithNewContext() {
try (ConfigurableApplicationContext context = SpringApplication.run(Empty.class,
"--spring.config.use-legacy-processing=true", "--spring.main.web-application-type=none",
"--debug=false", "--spring.main.bannerMode=OFF")) {
"--spring.cloud.bootstrap.enabled=true", "--spring.main.web-application-type=none", "--debug=false",
"--spring.main.bannerMode=OFF")) {
context.getEnvironment().setActiveProfiles("refresh");
List<String> names = names(context.getEnvironment().getPropertySources());
then(names).doesNotContain("applicationConfig: [classpath:/bootstrap-refresh.properties]");
@@ -82,8 +82,8 @@ public class ContextRefresherTests {
// Use spring.cloud.bootstrap.name to switch off the defaults (which would pick up
// a bootstrapProperties immediately
try (ConfigurableApplicationContext context = SpringApplication.run(Empty.class,
"--spring.config.use-legacy-processing=true", "--spring.main.web-application-type=none",
"--debug=false", "--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
"--spring.cloud.bootstrap.enabled=true", "--spring.main.web-application-type=none", "--debug=false",
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
List<String> names = names(context.getEnvironment().getPropertySources());
System.err.println("***** " + context.getEnvironment().getPropertySources());
then(names).doesNotContain("bootstrapProperties");
@@ -103,8 +103,8 @@ public class ContextRefresherTests {
// Use spring.cloud.bootstrap.name to switch off the defaults (which would pick up
// a bootstrapProperties immediately
try (ConfigurableApplicationContext context = SpringApplication.run(ContextRefresherTests.class,
"--spring.main.web-application-type=none", "--spring.config.use-legacy-processing=true",
"--debug=false", "--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
"--spring.main.web-application-type=none", "--spring.cloud.bootstrap.enabled=true", "--debug=false",
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
LegacyContextRefresher refresher = new LegacyContextRefresher(context, this.scope);
TestPropertyValues.of("spring.cloud.bootstrap.sources: "
+ "org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration")
@@ -123,8 +123,8 @@ public class ContextRefresherTests {
TestLoggingSystem system = (TestLoggingSystem) LoggingSystem.get(getClass().getClassLoader());
then(system.getCount()).isEqualTo(0);
try (ConfigurableApplicationContext context = SpringApplication.run(Empty.class,
"--spring.config.use-legacy-processing=true", "--spring.main.web-application-type=none",
"--debug=false", "--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
"--spring.cloud.bootstrap.enabled=true", "--spring.main.web-application-type=none", "--debug=false",
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
then(system.getCount()).isEqualTo(4);
ContextRefresher refresher = new LegacyContextRefresher(context, this.scope);
refresher.refresh();
@@ -138,9 +138,8 @@ public class ContextRefresherTests {
TestBootstrapConfiguration.fooSightings = new ArrayList<>();
try (ConfigurableApplicationContext context = SpringApplication.run(ContextRefresherTests.class,
"--spring.main.web-application-type=none", "--spring.config.use-legacy-processing=true",
"--debug=false", "--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh",
"--test.bootstrap.foo=bar")) {
"--spring.main.web-application-type=none", "--spring.cloud.bootstrap.enabled=true", "--debug=false",
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh", "--test.bootstrap.foo=bar")) {
context.getEnvironment().setActiveProfiles("refresh");
ContextRefresher refresher = new LegacyContextRefresher(context, this.scope);
refresher.refresh();
@@ -162,7 +161,7 @@ public class ContextRefresherTests {
@Test
public void legacyContextRefresherCreated() {
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
.withPropertyValues("spring.config.use-legacy-processing=true").run(context -> {
.withPropertyValues("spring.cloud.bootstrap.enabled=true").run(context -> {
assertThat(context).hasSingleBean(LegacyContextRefresher.class);
assertThat(context).hasSingleBean(ContextRefresher.class);
});

View File

@@ -45,7 +45,7 @@ public class RestartIntegrationTests {
public void testRestartTwice() throws Exception {
this.context = SpringApplication.run(TestConfiguration.class, "--management.endpoint.restart.enabled=true",
"--server.port=0", "--spring.config.use-legacy-processing=true",
"--server.port=0", "--spring.cloud.bootstrap.enabled=true",
"--management.endpoints.web.exposure.include=restart", "--spring.liveBeansView.mbeanDomain=livebeans");
RestartEndpoint endpoint = this.context.getBean(RestartEndpoint.class);

View File

@@ -35,7 +35,7 @@ public class RefreshScopeSerializationTests {
@Test
public void defaultApplicationContextId() throws Exception {
ConfigurableApplicationContext context = new SpringApplicationBuilder(TestConfiguration.class)
.properties("spring.config.use-legacy-processing=true").web(WebApplicationType.NONE).run();
.properties("spring.cloud.bootstrap.enabled=true").web(WebApplicationType.NONE).run();
then(context.getId()).isEqualTo("application-1");
}

View File

@@ -72,7 +72,7 @@ public class RefreshEndpointTests {
@Disabled // FIXME: legacy
public void keysComputedWhenAdded() throws Exception {
this.context = new SpringApplicationBuilder(Empty.class).web(WebApplicationType.NONE).bannerMode(Mode.OFF)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.bootstrap.name:none").run();
.properties("spring.cloud.bootstrap.enabled=true", "spring.cloud.bootstrap.name:none").run();
RefreshScope scope = new RefreshScope();
scope.setApplicationContext(this.context);
this.context.getEnvironment().setActiveProfiles("local");
@@ -86,7 +86,7 @@ public class RefreshEndpointTests {
@Disabled // FIXME: legacy
public void keysComputedWhenOveridden() throws Exception {
this.context = new SpringApplicationBuilder(Empty.class).web(WebApplicationType.NONE).bannerMode(Mode.OFF)
.properties("spring.config.use-legacy-processing=true", "spring.cloud.bootstrap.name:none").run();
.properties("spring.cloud.bootstrap.enabled=true", "spring.cloud.bootstrap.name:none").run();
RefreshScope scope = new RefreshScope();
scope.setApplicationContext(this.context);
this.context.getEnvironment().setActiveProfiles("override");
@@ -99,7 +99,7 @@ public class RefreshEndpointTests {
@Test
public void keysComputedWhenChangesInExternalProperties() throws Exception {
this.context = new SpringApplicationBuilder(Empty.class).web(WebApplicationType.NONE).bannerMode(Mode.OFF)
.properties("spring.cloud.bootstrap.name:none", "spring.config.use-legacy-processing=true").run();
.properties("spring.cloud.bootstrap.name:none", "spring.cloud.bootstrap.enabled=true").run();
RefreshScope scope = new RefreshScope();
scope.setApplicationContext(this.context);
TestPropertyValues.of("spring.cloud.bootstrap.sources=" + ExternalPropertySourceLocator.class.getName())