Skip to content

Commit 6de2f55

Browse files
authored
Added back the properties, but makred them as deprecated. Also fixed a unit test that would randomly fail. (Azure#26280)
1 parent 524055c commit 6de2f55

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/main/java/com/azure/spring/cloud/config/properties/AppConfigurationProperties.java

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import java.util.List;
77

88
import javax.annotation.PostConstruct;
9+
import javax.validation.constraints.NotEmpty;
910

1011
import org.springframework.boot.context.properties.ConfigurationProperties;
1112
import org.springframework.boot.context.properties.NestedConfigurationProperty;
1213
import org.springframework.context.annotation.Import;
14+
import org.springframework.lang.Nullable;
1315
import org.springframework.util.Assert;
1416
import org.springframework.util.StringUtils;
1517
import org.springframework.validation.annotation.Validated;
@@ -34,10 +36,21 @@ public final class AppConfigurationProperties {
3436
*/
3537
public static final String LABEL_SEPARATOR = ",";
3638

39+
/**
40+
* Context for loading configuration keys.
41+
*/
42+
@NotEmpty
43+
private String defaultContext = "application";
44+
3745
private boolean enabled = true;
3846

3947
private List<ConfigStore> stores = new ArrayList<>();
4048

49+
/**
50+
* Alternative to Spring application name, if not configured, fallback to default Spring application name
51+
**/
52+
private String name;
53+
4154
@NestedConfigurationProperty
4255
private AppConfigManagedIdentityProperties managedIdentity;
4356

@@ -71,6 +84,47 @@ public void setStores(List<ConfigStore> stores) {
7184
this.stores = stores;
7285
}
7386

87+
/**
88+
* The prefixed used before all keys loaded.
89+
* @deprecated Use spring.cloud.azure.appconfiguration[0].selects
90+
* @return null
91+
*/
92+
@Deprecated
93+
public String getDefaultContext() {
94+
return defaultContext;
95+
}
96+
97+
/**
98+
* Overrides the default context of `applicaiton`.
99+
* @deprecated Use spring.cloud.azure.appconfiguration[0].selects
100+
* @param defaultContext Key Prefix.
101+
*/
102+
@Deprecated
103+
public void setDefaultContext(String defaultContext) {
104+
this.defaultContext = defaultContext;
105+
}
106+
107+
/**
108+
* Used to override the spring.application.name value
109+
* @deprecated Use spring.cloud.azure.appconfiguration[0].selects
110+
* @return name
111+
*/
112+
@Deprecated
113+
@Nullable
114+
public String getName() {
115+
return name;
116+
}
117+
118+
/**
119+
* Used to override the spring.application.name value
120+
* @deprecated Use spring.cloud.azure.appconfiguration[0].selects
121+
* @param name application name in conifg key.
122+
*/
123+
@Deprecated
124+
public void setName(@Nullable String name) {
125+
this.name = name;
126+
}
127+
74128
/**
75129
* @return the managedIdentity
76130
*/

sdk/appconfiguration/azure-spring-cloud-appconfiguration-config/src/test/java/com/azure/spring/cloud/config/StateHolderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void expireState() {
3434

3535
@Test
3636
public void notExpireState() {
37-
String endpoint = "testEndpoint";
37+
String endpoint = "notTestEndpoint";
3838
List<ConfigurationSetting> watchKeys = new ArrayList<ConfigurationSetting>();
3939

4040
AppConfigurationStoreMonitoring monitoring = new AppConfigurationStoreMonitoring();

0 commit comments

Comments
 (0)