|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2020 the original author or authors. |
| 2 | + * Copyright 2012-2025 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
49 | 49 |
|
50 | 50 | /**
|
51 | 51 | * @author Dave Syer
|
| 52 | + * @author Yanming Zhou |
52 | 53 | *
|
53 | 54 | */
|
54 | 55 | public class BootstrapConfigurationTests {
|
@@ -740,6 +741,23 @@ void activeAndIncludeProfileFromBootstrapPropertySource_WhenMultiplePlacesHaveAc
|
740 | 741 | .anyMatch("local"::equals)).isTrue();
|
741 | 742 | }
|
742 | 743 |
|
| 744 | + @Test // GH-1416 |
| 745 | + public void bootstrapPropertiesWithActivateOnProfile() { |
| 746 | + String bootstrapLocation = "spring.cloud.bootstrap.location=classpath:external-properties/bootstrap.yaml"; |
| 747 | + String legacyProcessing = "spring.config.use-legacy-processing=true"; |
| 748 | + this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE) |
| 749 | + .sources(BareConfiguration.class) |
| 750 | + .properties(bootstrapLocation, legacyProcessing) |
| 751 | + .run(); |
| 752 | + then(this.context.getEnvironment().getProperty("info.name")).isEqualTo("externalPropertiesInfoName"); |
| 753 | + |
| 754 | + this.context = new SpringApplicationBuilder().web(WebApplicationType.NONE) |
| 755 | + .sources(BareConfiguration.class) |
| 756 | + .properties(bootstrapLocation, legacyProcessing, "spring.profiles.active=bar") |
| 757 | + .run(); |
| 758 | + then(this.context.getEnvironment().getProperty("info.name")).isEqualTo("externalPropertiesInfoName from bar"); |
| 759 | + } |
| 760 | + |
743 | 761 | @Configuration(proxyBeanMethods = false)
|
744 | 762 | @EnableConfigurationProperties
|
745 | 763 | protected static class BareConfiguration {
|
|
0 commit comments