Skip to content

Commit ba068c2

Browse files
authored
Update to 6.0.0 (#799)
1 parent 45aa9ef commit ba068c2

11 files changed

Lines changed: 128 additions & 31 deletions

File tree

  • appconfiguration
    • spring-cloud-azure-appconfiguration-config
      • spring-cloud-azure-appconfiguration-config-convert-sample
      • spring-cloud-azure-appconfiguration-config-sample/src/main/resources
    • spring-cloud-azure-feature-management-web/spring-cloud-azure-feature-management-web-sample/src/main/resources
    • spring-cloud-azure-feature-management/spring-cloud-azure-feature-management-sample/src/main/resources
    • spring-cloud-azure-starter-appconfiguration-config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
spring.config.import=azureAppConfiguration
2+
spring.cloud.azure.appconfiguration.stores[0].connection-string=${CONFIG_STORE_CONNECTION_STRING}

appconfiguration/spring-cloud-azure-appconfiguration-config/spring-cloud-azure-appconfiguration-config-convert-sample/spring-cloud-azure-appconfiguration-config-convert-sample-complete/src/main/resources/bootstrap.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

appconfiguration/spring-cloud-azure-appconfiguration-config/spring-cloud-azure-appconfiguration-config-convert-sample/spring-cloud-azure-appconfiguration-config-convert-sample-initial/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,10 @@ In this section, you clone a containerized Spring Boot application and test it l
179179
az appconfig kv set-keyvault --name myConfigStoreName --key "/application/azure.cosmos.key" --secret-identifier https://myVaultName.vault.azure.net/secrets/COSMOSDB-KEY --yes
180180
```
181181
182-
1. Delete `application.propertes` from `src/main/resources`.
182+
1. Update the application.yml file to now include, removing the other values.
183183
184-
1. Create a new file called `bootstrap.properties` in `src/main/resources`, and add the following.
185-
186-
```properties
184+
```yaml
185+
spring.config.import=azureAppConfiguration
187186
spring.cloud.azure.appconfiguration.stores[0].endpoint=https://{my-configstore-name}.azconfig.io
188187
```
189188

appconfiguration/spring-cloud-azure-appconfiguration-config/spring-cloud-azure-appconfiguration-config-sample/src/main/resources/bootstrap.yaml renamed to appconfiguration/spring-cloud-azure-appconfiguration-config/spring-cloud-azure-appconfiguration-config-sample/src/main/resources/application.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Use default application name and no profile configured
22
# Keys starting with /application/ will be matched
33
spring:
4+
config:
5+
import: azureAppConfiguration
46
cloud:
57
azure:
68
appconfiguration:

appconfiguration/spring-cloud-azure-feature-management-web/spring-cloud-azure-feature-management-web-sample/src/main/resources/application.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@ spring:
1010
config:
1111
message: Hi
1212
feature-management:
13-
Beta: true
14-
dark-theme:
15-
enabled-for:
16-
-
17-
name: Random
18-
parameters:
19-
chance: "50"
20-
beta-ab:
21-
enabled-for:
22-
-
23-
name: Random
24-
parameters:
25-
chance: "50"
26-
-
27-
name: ClientFilter
28-
parameters:
29-
clientIp: 10.0.0.1
13+
feature-flags:
14+
-
15+
id: beta
16+
enabled: true
17+
-
18+
id: dark-theme
19+
enabled: true
20+
conditions:
21+
client-filters:
22+
-
23+
name: Random
24+
parameters:
25+
chance: "50"
26+
-
27+
id: beta-ab
28+
enabled: true
29+
conditions:
30+
client-filters:
31+
-
32+
name: Random
33+
parameters:
34+
chance: "50"
35+
-
36+
name: ClientFilter
37+
parameters:
38+
clientIp: 10.0.0.1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
feature-management:
2-
beta:
3-
enabled-for:
4-
- name: Random
5-
parameters:
6-
chance: "80"
2+
feature-flags:
3+
-
4+
id: beta
5+
enabled: true
6+
conditions:
7+
client-filters:
8+
- name: Random
9+
parameters:
10+
chance: "80"

appconfiguration/spring-cloud-azure-starter-appconfiguration-config/spring-cloud-azure-starter-appconfiguration-config-entraid-sample/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ description: This sample demonstrates how to refresh configuration properties fr
3131
az appconfig kv set --key /application/config.message --value testKey --name <name-of-your-new-store> --yes
3232
```
3333
34+
1. Create the feature flag in your new store:
35+
36+
```azurecli
37+
az appconfig feature set --feature alpha --name <name-of-your-new-store>
38+
```
39+
3440
1. Create monitor trigger.
3541
3642
```azurecli
@@ -91,6 +97,28 @@ This value should match the `spring.cloud.azure.appconfiguration.stores[0].monit
9197

9298
1. After a couple seconds refresh again, this time the new value `updatedTestKey` will show.
9399

100+
1. Go to `localhost:8080/feature-flag/alpha` which will display the status of the feature flag.
101+
102+
1. Update the feature flag in your App Configuration store.
103+
104+
```azurecli
105+
az appconfig feature enable --feature alpha --name <name-of-your-new-store>
106+
```
107+
108+
1. Refresh page, this will trigger the refresh update.
109+
110+
1. After a couple seconds refresh again, this time the new value `updatedTestKey` will show.
111+
112+
1. Go to `localhost:8080/feature-flag/alpha` which will display the status of the feature flag.
113+
114+
1. Update the feature flag in your App Configuration store.
115+
116+
```azurecli
117+
az appconfig feature enable --feature alpha --name <name-of-your-new-store>
118+
```
119+
120+
1. After a couple seconds refresh the page twice, this time the feature flag status will show as enabled.
121+
94122
## Deploy to Azure Spring Apps
95123

96124
Now that you have the Spring Boot application running locally, it's time to move it to production. [Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/overview) makes it easy to deploy Spring Boot applications to Azure without any code changes. The service manages the infrastructure of Spring applications so developers can focus on their code. Azure Spring Apps provides lifecycle management using comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, blue-green deployments, and more. To deploy your application to Azure Spring Apps, see [Deploy your first application to Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/quickstart?tabs=Azure-CLI).

appconfiguration/spring-cloud-azure-starter-appconfiguration-config/spring-cloud-azure-starter-appconfiguration-config-entraid-sample/src/main/java/example/HelloController.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.PathVariable;
1011
import org.springframework.web.bind.annotation.RestController;
1112

13+
import com.azure.spring.cloud.feature.management.FeatureManager;
1214
import com.fasterxml.jackson.core.JsonProcessingException;
1315

1416
@RestController
@@ -17,9 +19,21 @@ public class HelloController {
1719
@Autowired
1820
private MessageProperties properties;
1921

22+
@Autowired
23+
private FeatureManager featureManager;
24+
2025
@GetMapping("")
2126
public String getMessage() throws JsonProcessingException {
2227
return properties.getMessage();
2328
}
2429

30+
@GetMapping("/feature-flag/{name}")
31+
public String getFeatureFlag(@PathVariable String name) {
32+
if (featureManager.isEnabled(name)) {
33+
return "Feature flag '" + name + "' is enabled.";
34+
} else {
35+
return "Feature flag '" + name + "' is disabled.";
36+
}
37+
}
38+
2539
}

appconfiguration/spring-cloud-azure-starter-appconfiguration-config/spring-cloud-azure-starter-appconfiguration-config-entraid-sample/src/main/resources/bootstrap.properties renamed to appconfiguration/spring-cloud-azure-starter-appconfiguration-config/spring-cloud-azure-starter-appconfiguration-config-entraid-sample/src/main/resources/application.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
spring.config.import=azureAppConfiguration
2+
13
spring.cloud.azure.appconfiguration.stores[0].endpoint=${CONFIG_STORE_ENDPOINT}
24

5+
spring.cloud.azure.appconfiguration.stores[0].feature-flags.enabled=true
6+
37
spring.cloud.azure.appconfiguration.stores[0].monitoring.enabled=true
48
spring.cloud.azure.appconfiguration.stores[0].monitoring.refresh-interval=5s
59
spring.cloud.azure.appconfiguration.stores[0].monitoring.triggers[0].key=sentinel
10+
11+
# These will only show when feature flags above are disabled.
12+
feature-management.feature-flags[100].id=gamma
13+
feature-management.feature-flags[100].enabled=true

appconfiguration/spring-cloud-azure-starter-appconfiguration-config/spring-cloud-azure-starter-appconfiguration-config-sample/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ description: This sample demonstrates how to refresh configuration properties fr
3131
az appconfig kv set --key /application/config.message --value testKey --name <name-of-your-new-store> --yes
3232
```
3333
34+
1. Create the feature flag in your new store:
35+
36+
```azurecli
37+
az appconfig feature set --feature alpha --name <name-of-your-new-store>
38+
```
39+
3440
1. Create monitor trigger.
3541
3642
```azurecli
@@ -71,6 +77,28 @@ This value should match the `spring.cloud.azure.appconfiguration.stores[0].monit
7177
7278
1. After a couple seconds refresh again, this time the new value `updatedTestKey` will show.
7379
80+
1. Go to `localhost:8080/feature-flag/alpha` which will display the status of the feature flag.
81+
82+
1. Update the feature flag in your App Configuration store.
83+
84+
```azurecli
85+
az appconfig feature enable --feature alpha --name <name-of-your-new-store>
86+
```
87+
88+
1. Refresh page, this will trigger the refresh update.
89+
90+
1. After a couple seconds refresh again, this time the new value `updatedTestKey` will show.
91+
92+
1. Go to `localhost:8080/feature-flag/alpha` which will display the status of the feature flag.
93+
94+
1. Update the feature flag in your App Configuration store.
95+
96+
```azurecli
97+
az appconfig feature enable --feature alpha --name <name-of-your-new-store>
98+
```
99+
100+
1. After a couple seconds refresh the page twice, this time the feature flag status will show as enabled.
101+
74102
## Deploy to Azure Spring Apps
75103
76104
Now that you have the Spring Boot application running locally, it's time to move it to production. [Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/overview) makes it easy to deploy Spring Boot applications to Azure without any code changes. The service manages the infrastructure of Spring applications so developers can focus on their code. Azure Spring Apps provides lifecycle management using comprehensive monitoring and diagnostics, configuration management, service discovery, CI/CD integration, blue-green deployments, and more. To deploy your application to Azure Spring Apps, see [Deploy your first application to Azure Spring Apps](https://learn.microsoft.com/azure/spring-apps/quickstart?tabs=Azure-CLI).

0 commit comments

Comments
 (0)