Skip to content

Commit 3410176

Browse files
committed
Spring Quickstarts Update
1 parent de2dadd commit 3410176

3 files changed

Lines changed: 56 additions & 159 deletions

File tree

articles/azure-app-configuration/enable-dynamic-configuration-java-spring-app.md

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: mrm9084
77
ms.service: azure-app-configuration
88
ms.devlang: java
99
ms.topic: tutorial
10-
ms.date: 02/10/2026
10+
ms.date: 03/16/2026
1111
ms.custom: devx-track-java, devx-track-extended-java
1212
ms.author: mametcal
1313
#Customer intent: As a Java Spring developer, I want to dynamically update my app to use the latest configuration data in App Configuration.
@@ -34,24 +34,26 @@ App Configuration exposes `AppConfigurationRefresh`, which checks if the refresh
3434
1. To use `AppConfigurationRefresh`, update HelloController.
3535

3636
```java
37-
import com.azure.spring.cloud.config.AppConfigurationRefresh;
38-
37+
import org.springframework.beans.factory.annotation.Autowired;
38+
import org.springframework.web.bind.annotation.GetMapping;
39+
import org.springframework.web.bind.annotation.RestController;
40+
41+
import com.azure.spring.cloud.appconfiguration.config.AppConfigurationRefresh;
42+
3943
@RestController
4044
public class HelloController {
41-
private final MessageProperties properties;
42-
43-
@Autowired(required = false)
44-
private AppConfigurationRefresh refresh;
45-
46-
public HelloController(MessageProperties properties) {
47-
this.properties = properties;
48-
}
49-
45+
46+
@Autowired
47+
private final AppConfigurationRefresh appConfigurationRefresh;
48+
49+
@Autowired
50+
private final MyProperties properties;
51+
5052
@GetMapping
51-
public String getMessage() throws InterruptedException, ExecutionException {
52-
if (refresh != null) {
53-
refresh.refreshConfigurations();
54-
}
53+
public String hello() {
54+
// Manually refresh configuration from Azure App Configuration
55+
appConfigurationRefresh.refreshConfigurations().block();
56+
// Read the property value from @ConfigurationProperties bean
5557
return "Message: " + properties.getMessage();
5658
}
5759
}
@@ -66,24 +68,12 @@ App Configuration exposes `AppConfigurationRefresh`, which checks if the refresh
6668
> new Thread(() -> refresh.refreshConfigurations()).start();
6769
> ```
6870

69-
1. To enable refresh update `bootstrap.properties`:
71+
1. To enable refresh update `application.properties`:
7072

7173
```properties
7274
spring.cloud.azure.appconfiguration.stores[0].monitoring.enabled=true
73-
spring.cloud.azure.appconfiguration.stores[0].monitoring.refresh-interval= 30s
74-
spring.cloud.azure.appconfiguration.stores[0].monitoring.triggers[0].key=sentinel
7575
```
7676

77-
1. Open the **Azure portal** and navigate to your App Configuration resource associated with your application. Select **Configuration Explorer** under **Operations** and create a new key-value pair by selecting **+ Create** > **Key-value** to add the following parameters:
78-
79-
| Key | Value |
80-
|---|---|
81-
| sentinel | 1 |
82-
83-
Leave **Label** and **Content Type** empty for now.
84-
85-
1. Select **Apply**.
86-
8777
1. Build your Spring Boot application with Maven and run it.
8878

8979
```shell
@@ -105,12 +95,6 @@ App Configuration exposes `AppConfigurationRefresh`, which checks if the refresh
10595
|---|---|
10696
| /application/config.message | Hello - Updated |
10797

108-
1. Update the sentinel key you created earlier to a new value. This change triggers the application to refresh all configuration keys once the refresh interval is passed.
109-
110-
| Key | Value |
111-
|---|---|
112-
| sentinel | 2 |
113-
11498
1. Refresh the browser page twice to see the new message displayed. The first time triggers the refresh, the second loads the changes.
11599

116100
> [!NOTE]
@@ -126,28 +110,16 @@ Then, open the *pom.xml* file in a text editor and add a `<dependency>` for `spr
126110
<dependency>
127111
<groupId>com.azure.spring</groupId>
128112
<artifactId>spring-cloud-azure-appconfiguration-config-web</artifactId>
129-
<version>7.0.0</version>
113+
<version>7.1.0</version>
130114
</dependency>
131115
```
132116

133117
1. To enable refresh update `application.properties`:
134118

135119
```properties
136120
spring.cloud.azure.appconfiguration.stores[0].monitoring.enabled=true
137-
spring.cloud.azure.appconfiguration.stores[0].monitoring.refresh-interval= 30s
138-
spring.cloud.azure.appconfiguration.stores[0].monitoring.triggers[0].key=sentinel
139121
```
140122

141-
1. Open the **Azure portal** and navigate to your App Configuration resource associated with your application. Select **Configuration Explorer** under **Operations** and create a new key-value pair by selecting **+ Create** > **Key-value** to add the following parameters:
142-
143-
| Key | Value |
144-
|---|---|
145-
| sentinel | 1 |
146-
147-
Leave **Label** and **Content Type** empty for now.
148-
149-
1. Select **Apply**.
150-
151123
1. Build your Spring Boot application with Maven and run it.
152124

153125
```shell
@@ -169,12 +141,6 @@ Then, open the *pom.xml* file in a text editor and add a `<dependency>` for `spr
169141
|---|---|
170142
| /application/config.message | Hello - Updated |
171143

172-
1. Update the sentinel key you created earlier to a new value. This change triggers the application to refresh all configuration keys once the refresh interval is passed.
173-
174-
| Key | Value |
175-
|---|---|
176-
| sentinel | 2 |
177-
178144
1. Refresh the browser page twice to see the new message displayed. The first time triggers the refresh, the second loads the changes, as the first request returns using the original scope.
179145

180146
> [!NOTE]

articles/azure-app-configuration/quickstart-feature-flag-spring-boot.md

Lines changed: 26 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: mrm9084
55
ms.service: azure-app-configuration
66
ms.devlang: java
77
ms.topic: quickstart
8-
ms.date: 02/10/2026
8+
ms.date: 03/16/2026
99
ms.author: mametcal
1010
ms.custom: devx-track-java, mode-other
1111
#Customer intent: As an Spring Boot developer, I want to use feature flags to control feature availability quickly and confidently.
@@ -21,7 +21,7 @@ The Spring Boot Feature Management libraries extend the framework with comprehen
2121

2222
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
2323
- An App Configuration store, as shown in the [tutorial for creating a store](./quickstart-azure-app-configuration-create.md#create-an-app-configuration-store).
24-
- A supported [Java Development Kit SDK](/java/azure/jdk) with version 11.
24+
- A supported [Java Development Kit SDK](/java/azure/jdk) with version 17.
2525
- [Apache Maven](https://maven.apache.org/download.cgi) version 3.0 or above.
2626

2727
## Add a feature flag
@@ -40,7 +40,7 @@ To create a new Spring Boot project:
4040
1. Specify the following options:
4141

4242
* Generate a **Maven** project with **Java**.
43-
* Specify a **Spring Boot** version that's equal to or greater than 2.0.
43+
* Specify a **Spring Boot** version that's equal to or greater than 3.0.
4444
* Specify the **Group** and **Artifact** names for your application. This article uses `com.example` and `demo`.
4545
* Add the **Spring Web** dependency.
4646

@@ -71,7 +71,7 @@ To create a new Spring Boot project:
7171
<dependency>
7272
<groupId>com.azure.spring</groupId>
7373
<artifactId>spring-cloud-azure-dependencies</artifactId>
74-
<version>7.0.0</version>
74+
<version>7.1.0</version>
7575
<type>pom</type>
7676
<scope>import</scope>
7777
</dependency>
@@ -84,7 +84,7 @@ To create a new Spring Boot project:
8484
8585
## Connect to an App Configuration store
8686

87-
1. Navigate to the `resources` directory of your app and open the `bootstrap.properties` or `bootstrap.yaml` file. If the file doesn't exist, create it.
87+
1. Navigate to the `resources` directory of your app and open the `application.properties` or `application.yaml` file. If the file doesn't exist, create it.
8888

8989
You can connect to your App Configuration store using Microsoft Entra ID (recommended), or a connection string.
9090

@@ -94,7 +94,7 @@ To create a new Spring Boot project:
9494
If you're using a properties file, use the following code:
9595
```properties
9696
spring.config.import=azureAppConfiguration
97-
spring.cloud.azure.appconfiguration.stores[0].endpoint= ${APP_CONFIGURATION_ENDPOINT}
97+
spring.cloud.azure.appconfiguration.stores[0].endpoint= ${AZURE_APPCONFIG_ENDPOINT}
9898
spring.cloud.azure.appconfiguration.stores[0].feature-flags.enabled=true
9999
```
100100

@@ -107,60 +107,18 @@ To create a new Spring Boot project:
107107
azure:
108108
appconfiguration:
109109
stores:
110-
-
110+
- endpoint: ${AZURE_APPCONFIG_ENDPOINT}
111111
feature-flags:
112-
enabled: true
113-
endpoint: ${APP_CONFIGURATION_ENDPOINT}
112+
enabled: true
114113
```
115114
116115
You use the `DefaultAzureCredential` to authenticate to your App Configuration store. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
117116
118-
1. Add the following code to your project, unless you want to use Managed Identity. Create a new file named `AppConfigCredential.java`:
119-
120-
```java
121-
import com.azure.data.appconfiguration.ConfigurationClientBuilder;
122-
import com.azure.identity.DefaultAzureCredentialBuilder;
123-
import com.azure.spring.cloud.appconfiguration.config.ConfigurationClientCustomizer;
124-
125-
public class AppConfigCredential implements ConfigurationClientCustomizer {
126-
127-
@Override
128-
public void customize(ConfigurationClientBuilder builder, String endpoint) {
129-
builder.credential(new DefaultAzureCredentialBuilder().build());
130-
}
131-
}
132-
```
133-
134-
1. Create a new file named `MyConfiguration.java` and add the following lines:
135-
136-
```java
137-
import org.springframework.context.annotation.Bean;
138-
import org.springframework.context.annotation.Configuration;
139-
140-
@Configuration
141-
public class MyConfiguration {
142-
143-
144-
@Bean
145-
public AppConfigCredential clientSetup() {
146-
return new AppConfigCredential();
147-
}
148-
149-
}
150-
```
151-
152-
1. Add configuration Bootstrap Configuration, by creating `spring.factories` file under `resources/META-INF` directory and add the following lines and updating `com.example.MyConfiguration` with your application package:
153-
154-
```factories
155-
org.springframework.cloud.bootstrap.BootstrapConfiguration=\
156-
com.example.MyConfiguration
157-
```
158-
159117
### [Connection string](#tab/connection-string)
160118
If you are using a properties file, use the following code:
161119
```properties
162120
spring.config.import=azureAppConfiguration
163-
spring.cloud.azure.appconfiguration.stores[0].endpoint= ${APP_CONFIGURATION_CONNECTION_STRING}
121+
spring.cloud.azure.appconfiguration.stores[0].connection-string= ${APP_CONFIG_CONNECTION_STRING}
164122
spring.cloud.azure.appconfiguration.stores[0].feature-flags.enabled=true
165123
```
166124
@@ -172,10 +130,10 @@ To create a new Spring Boot project:
172130
cloud:
173131
azure:
174132
appconfiguration:
175-
stores[0]:
176-
feature-flags:
177-
enabled: 'true'
178-
connection-string: ${APP_CONFIGURATION_CONNECTION_STRING}
133+
stores:
134+
- connection-string: ${APP_CONFIG_CONNECTION_STRING}
135+
feature-flags:
136+
enabled: true
179137
```
180138
---
181139
@@ -217,10 +175,8 @@ To create a new Spring Boot project:
217175
<title>Feature Management with Spring Cloud Azure</title>
218176
219177
<link rel="stylesheet" href="/css/main.css">
220-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
178+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
221179
222-
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
223-
<script src="https://unpkg.com/@popperjs/core@2"></script>
224180
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
225181
226182
</head>
@@ -229,13 +185,13 @@ To create a new Spring Boot project:
229185
<!-- Fixed navbar -->
230186
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
231187
<a class="navbar-brand" href="#">TestFeatureFlags</a>
232-
<button class="navbar-toggler" aria-expanded="false" aria-controls="navbarCollapse" aria-label="Toggle navigation" type="button" data-target="#navbarCollapse" data-toggle="collapse">
188+
<button class="navbar-toggler" aria-expanded="false" aria-controls="navbarCollapse" aria-label="Toggle navigation" type="button" data-bs-target="#navbarCollapse" data-bs-toggle="collapse">
233189
<span class="navbar-toggler-icon"></span>
234190
</button>
235191
<div class="collapse navbar-collapse" id="navbarCollapse">
236-
<ul class="navbar-nav mr-auto">
192+
<ul class="navbar-nav me-auto">
237193
<li class="nav-item active">
238-
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
194+
<a class="nav-link" href="#">Home <span class="visually-hidden">(current)</span></a>
239195
</li>
240196
<li class="nav-item" th:if="${Beta}">
241197
<a class="nav-link" href="#">Beta</a>
@@ -254,13 +210,12 @@ To create a new Spring Boot project:
254210
</div>
255211
<footer class="footer">
256212
<div class="container">
257-
<span class="text-muted">&copy; 2019 - Projects</span>
213+
<span class="text-muted">&copy; 2026 - Projects</span>
258214
</div>
259215
260216
</footer>
261217
</body>
262218
</html>
263-
264219
```
265220
266221
1. Create a new folder named CSS under `static` and inside of it a new CSS file named *main.css*.
@@ -301,46 +256,46 @@ To create a new Spring Boot project:
301256
1. Set an environment variable.
302257
303258
### [Microsoft Entra ID (recommended)](#tab/entra-id)
304-
Set the environment variable named **APP_CONFIGURATION_ENDPOINT** to the endpoint of your App Configuration store found under the *Overview* of your store in the Azure portal.
259+
Set the environment variable named **AZURE_APPCONFIG_ENDPOINT** to the endpoint of your App Configuration store found under the *Overview* of your store in the Azure portal.
305260
306261
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
307262
308263
```cmd
309-
setx APP_CONFIGURATION_ENDPOINT "endpoint-of-your-app-configuration-store"
264+
setx AZURE_APPCONFIG_ENDPOINT "endpoint-of-your-app-configuration-store"
310265
```
311266
312267
If you use PowerShell, run the following command:
313268
314269
```powershell
315-
$Env:APP_CONFIGURATION_ENDPOINT = "<endpoint-of-your-app-configuration-store>"
270+
$Env:AZURE_APPCONFIG_ENDPOINT = "<endpoint-of-your-app-configuration-store>"
316271
```
317272
318273
If you use macOS or Linux, run the following command:
319274
320275
```bash
321-
export APP_CONFIGURATION_ENDPOINT='<endpoint-of-your-app-configuration-store>'
276+
export AZURE_APPCONFIG_ENDPOINT='<endpoint-of-your-app-configuration-store>'
322277
```
323278
324279
### [Connection string](#tab/connection-string)
325280
326-
Set the environment variable named **APP_CONFIGURATION_CONNECTION_STRING** to the read-only connection string of your App Configuration store found under *Access settings* of your store in the Azure portal.
281+
Set the environment variable named **APP_CONFIG_CONNECTION_STRING** to the read-only connection string of your App Configuration store found under *Access settings* of your store in the Azure portal.
327282
328283
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
329284
330285
```cmd
331-
setx APP_CONFIGURATION_CONNECTION_STRING "<connection-string-of-your-app-configuration-store>"
286+
setx APP_CONFIG_CONNECTION_STRING "<connection-string-of-your-app-configuration-store>"
332287
```
333288
334289
If you use PowerShell, run the following command:
335290
336291
```powershell
337-
$Env:APP_CONFIGURATION_CONNECTION_STRING = "<connection-string-of-your-app-configuration-store>"
292+
$Env:APP_CONFIG_CONNECTION_STRING = "<connection-string-of-your-app-configuration-store>"
338293
```
339294
340295
If you use macOS or Linux, run the following command:
341296
342297
```bash
343-
export APP_CONFIGURATION_CONNECTION_STRING='<connection-string-of-your-app-configuration-store>'
298+
export APP_CONFIG_CONNECTION_STRING='<connection-string-of-your-app-configuration-store>'
344299
```
345300
---
346301

0 commit comments

Comments
 (0)