You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/java/spring-framework/app-configuration-support.md
+20-21Lines changed: 20 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,7 @@ In this example, if both the stores have the same configuration key, then the co
144
144
145
145
### Selecting configurations
146
146
147
-
The library loads configurations using their key and label. By default, the configurations that start with the key `/application/` are loaded. The default label is `\0`, which appears as `(No Label)` in the Azure portal. If a Spring profile is set, and no label is provided, then the default label is your Spring Profiles which is `${spring.profiles.active}`.
147
+
The library loads configurations using their key and label. By default, the configurations that start with the key `/application/` are loaded. The default label is `\0`, which appears as `(No Label)` in the Azure portal. If a Spring profile is set, and no label is provided, then the default label is your Spring Profile, which is `${spring.profiles.active}`.
148
148
149
149
You can configure which configurations are loaded by selecting different key and label filters:
150
150
@@ -172,7 +172,7 @@ The `label-filter` property supports the following filters:
172
172
|`1.0.*`| Matches labels that start with `1.0.*`. |
173
173
|`,1.0.0`| Matches labels `null` and `1.0.0`. Limited to five comma-separated values. |
174
174
175
-
If you're using YAML with label filters, and you want to load configuration with no label and more configurations with other labels you need to include an empty `,` for example `,dev`will match `\0` and `dev`, then the label filter needs to be surrounded by single quotes. This allows you to load configuration with no label first, followed by configurations with specific labels in the same filter:
175
+
If you're using YAML with label filters, and you want to load configurations with no label and more configurations with other labels, you need to include an empty `,`. For example,`,dev`matches `\0` and `dev`. In this case, surround the label filter with single quotes. This value enables you to load configuration with no label first, followed by configurations with specific labels, in the same filter:
176
176
177
177
```yml
178
178
spring:
@@ -186,9 +186,8 @@ spring:
186
186
187
187
> [!NOTE]
188
188
> You can't combine `*` with `,` in filters. In that case, you need to use an additional select value.
189
-
190
-
> [!NOTE]
191
-
> When using `*` in the label filter, and multiple configurations with the same key are loaded, they are loaded in alphabetical order, and the label last in alphabetical order is used.
189
+
>
190
+
> When you use `*` in the label filter, and multiple configurations with the same key are loaded, they're loaded in alphabetical order, and the label last in alphabetical order is used.
In the first `label-filter`, the library first loads all configurations with the `\0` label, followed by all configurations matching the Spring Profiles. Spring Profiles have priority over the `\0` configurations, because they're at the end.
203
202
204
-
In the second `label-filter`, the string `_local` is appended to the end of the Spring Profiles, though only to the last Spring Profile if there is more than one.
203
+
In the second `label-filter`, the string `_local` is appended to the end of the Spring Profiles, though only to the last Spring Profile if there's more than one.
205
204
206
205
### Disabled stores
207
206
@@ -221,7 +220,7 @@ Authentication through connection string is the simplest form to set up, though
221
220
az appconfig credential list --name <name-of-your-store>
222
221
```
223
222
224
-
You can then set the `spring.cloud.azure.appconfiguration.stores[0].connection-string` property to the connection string. When using this approach, it's highly recommend to set the connection string in the local configuration file to a placeholder value that maps to an environment variable. This approach enables you to avoid adding the connection string to source control.
223
+
You can then set the `spring.cloud.azure.appconfiguration.stores[0].connection-string` property to the connection string. When using this approach, we highly recommend setting the connection string in the local configuration file to a placeholder value that maps to an environment variable. This approach enables you to avoid adding the connection string to source control.
225
224
226
225
### Spring Cloud Azure configuration
227
226
@@ -255,13 +254,13 @@ Each replica you create has a dedicated endpoint. If your application resides in
255
254
256
255
By default, the library auto discovers all replicas that exist for a configuration store. When a request is made to the provided store and fails, the library automatically retries the request against the available replicas.
257
256
258
-
The failover may occur if the library observes any of the following conditions:
257
+
The failover might occur if the library observes any of the following conditions:
259
258
260
259
- Receives responses with service unavailable status code (HTTP 500 or above) from an endpoint.
261
260
- Experiences network connectivity issues.
262
261
- Requests are throttled (HTTP status code 429).
263
262
264
-
Once the provided store comes back online, the library automatically retries the request against the provided store.
263
+
After the provided store comes back online, the library automatically retries the request against the provided store.
265
264
266
265
If you want to control the failover behavior, you can manually provide a list of stores to use for failover.
If all provided replica endpoints fail, the library attempts to connect to auto discovered replicas of the primary store.
281
280
282
-
Replication can be disabled with the setting `spring.cloud.azure.appconfiguration.stores[0].replica-discovery-enabled=false`.
281
+
You can disable replication with the setting `spring.cloud.azure.appconfiguration.stores[0].replica-discovery-enabled=false`.
283
282
284
283
### Creating a configuration store with geo-replication
285
284
@@ -357,11 +356,11 @@ You can create any secret-identifier through the Azure CLI. Secret identifiers j
357
356
358
357
You can use [Spring Cloud Azure configuration](configuration.md) to configure the library. You can use the same credential used to connect to App Configuration to connect to Azure Key Vault.
359
358
360
-
In addition, you can create a `SecretClientCustomizer` the same way as you would create a `ConfigurationClientCustomizer` to provide your own authentication method.
359
+
You can also create a `SecretClientCustomizer` the same way as you would create a `ConfigurationClientCustomizer` to provide your own authentication method.
361
360
362
361
#### Resolve non-Key Vault secrets
363
362
364
-
The App Configuration library provides a method to override the resolution of key vault references. For example, it can be used to locally resolve secrets in a dev environment. This resolution is done through the `KeyVaultSecretProvider`. The `KeyVaultSecretProvider` if provided is called on every key vault reference. If `getSecret` returns a non-null value, it is used as the secret value. Otherwise, the Key Vault Reference is resolved normally.
363
+
The App Configuration library provides a method to override the resolution of key vault references. For example, you can use it to locally resolve secrets in a dev environment. This resolution is done through the `KeyVaultSecretProvider`. The `KeyVaultSecretProvider`, if provided, is called on every key vault reference. If `getSecret` returns a non-null value, it's used as the secret value. Otherwise, the Key Vault Reference is resolved normally.
365
364
366
365
```java
367
366
public class MySecretProvider implements KeyVaultSecretProvider {
Feature flags are composed of multiple parts including; a name and a list of feature-filters that are used to turn on the feature. Feature flags can either have a boolean state of on/off, or they can have a list of feature filters. Feature flags evaluate feature filters until one returns `true`. If no feature filter returns `true`, then the feature flag returns `false`.
406
+
Feature flags are composed of multiple parts including a name and a list of feature-filters that are used to turn on the feature. Feature flags can either have a boolean state of on or off, or they can have a list of feature filters. Feature flags evaluate feature filters until one returns `true`. If no feature filter returns `true`, then the feature flag returns `false`.
408
407
409
408
#### Feature filters
410
409
@@ -473,7 +472,7 @@ if (featureManager.isEnabled("feature-t")) {
473
472
> [!NOTE]
474
473
> `FeatureManager` also has an asynchronous version of `isEnabled` called `isEnabledAsync`.
475
474
476
-
Without feature management configuration or when the feature flag does not exist, `isEnabled` always returns `false`. If an existing feature flag is configured with an unknown feature filter, then a `FilterNotFoundException` is thrown. You can change this behavior to return `false` by configuring `fail-fast` to `false`. The following table describes `fail-fast`:
475
+
Without feature management configuration or when the feature flag doesn't exist, `isEnabled` always returns `false`. If an existing feature flag is configured with an unknown feature filter, then a `FilterNotFoundException` is thrown. You can change this behavior to return `false` by configuring `fail-fast` to `false`. The following table describes `fail-fast`:
@@ -515,7 +514,7 @@ public class MyDisabledFeaturesHandler implements DisabledFeaturesHandler {
515
514
516
515
##### Routing
517
516
518
-
Certain routes may expose application capabilities that are gated by features. If a feature is disabled, you can redirect these routes to another endpoint, as shown in the following example:
517
+
Certain routes might expose application capabilities that are gated by features. If a feature is disabled, you can redirect these routes to another endpoint, as shown in the following example:
519
518
520
519
```java
521
520
@GetMapping("/featureT")
@@ -542,7 +541,7 @@ This filter always returns `true`. For a usage example, see the [feature flag de
542
541
543
542
#### PercentageFilter
544
543
545
-
Each time it is checked, the evaluation of `PercentageFilter` can return a different result. You can circumvent this inconsistency by using the `FeatureManagementSnapshot`, which caches the result of the feature flag per request.
544
+
Each time it's checked, the evaluation of `PercentageFilter` can return a different result. You can circumvent this inconsistency by using the `FeatureManagementSnapshot`, which caches the result of the feature flag per request.
546
545
547
546
```yaml
548
547
feature-management:
@@ -571,7 +570,7 @@ feature-management:
571
570
End: "Mon, 01 July 2019 00:00:00 GMT"
572
571
```
573
572
574
-
This filter also, supports recurring time window filters. It supports both daily and weekly recurrences, along with an expiration time.
573
+
This filter also supports recurring time window filters. It supports both daily and weekly recurrences, along with an expiration time.
575
574
576
575
```yaml
577
576
feature-management:
@@ -593,7 +592,7 @@ feature-management:
593
592
- Wednesday
594
593
```
595
594
596
-
This recurrence pattern happens every week on Monday and Wednesday. From 00:00:00 GMT to 12:00:00 GMT and will never expire.
595
+
This recurrence pattern happens every week on Monday and Wednesday from 00:00:00 GMT to 12:00:00 GMT and doesn't expire.
597
596
598
597
```yaml
599
598
feature-management:
@@ -664,7 +663,7 @@ public class Random implements FeatureFilter {
664
663
665
664
#### Parameterized feature filters
666
665
667
-
Some feature filters require parameters to determine whether a feature should be turned on. For example, a browser feature filter may turn on a feature for a certain set of browsers. You might want a feature enabled for Microsoft Edge and Chrome browsers, but not Firefox. To set up this situation, you can design a feature filter to expect parameters. These parameters would be specified in the feature configuration and in code, and would be accessible via the `FeatureFilterEvaluationContext` parameter of `evaluate`. `FeatureFilterEvaluationContext` has a property `parameters`, which is a `Map<String, Object>`.
666
+
Some feature filters require parameters to determine whether a feature should be turned on. For example, a browser feature filter might turn on a feature for a certain set of browsers. You might want a feature enabled for Microsoft Edge and Chrome browsers, but not Firefox. To set up this situation, you can design a feature filter to expect parameters. These parameters would be specified in the feature configuration and in code, and would be accessible via the `FeatureFilterEvaluationContext` parameter of `evaluate`. `FeatureFilterEvaluationContext` has a property `parameters`, which is a `Map<String, Object>`.
668
667
669
668
### Targeting
670
669
@@ -716,7 +715,7 @@ Options are available to customize how targeting evaluation is performed across
716
715
717
716
Enabling config refresh for your configurations lets you pull their latest values from your App Configuration store or stores without having to restart the application.
718
717
719
-
To enable refresh, you need to enable monitoring along with monitoring triggers. A monitoring trigger is a key with an optional label which the system monitors for value changes to trigger updates. The value of the monitoring trigger can be any value, as long as it changes when a refresh is needed.
718
+
To enable refresh, you need to enable monitoring along with monitoring triggers. A monitoring trigger is a key with an optional label that the system monitors for value changes to trigger updates. The value of the monitoring trigger can be any value, as long as it changes when a refresh is needed.
720
719
721
720
> [!NOTE]
722
721
> Any operation that changes the ETag of a monitoring trigger causes a refresh, such as a content-type change.
@@ -747,7 +746,7 @@ After the application generates the log, it refreshes all `@Bean`s in the refres
747
746
748
747
### Pull-based refresh
749
748
750
-
The App Configuration Spring libraries support the ability to periodically check on a refresh interval for changes made to the monitoring triggers. By default, the refresh interval is set to 30 seconds. After the refresh interval has passed, when a refresh attempt is made, all triggers are checked in the given store for changes. Any change to the key causes a refresh to trigger. Because the libraries integrate with the Spring refresh system, any refresh reloads all configurations from all stores. You can set the refresh interval to any interval longer than 1 second. The supported units for the refresh interval are `s`, `m`, `h`, and `d` for seconds, minutes, hours, and days respectively. The following example sets the refresh interval to 5 minutes:
749
+
The App Configuration Spring libraries support the ability to periodically check on a refresh interval for changes made to the monitoring triggers. By default, the refresh interval is set to 30 seconds. After the refresh interval passes, when a refresh attempt is made, all triggers are checked in the given store for changes. Any change to the key causes a refresh to trigger. Because the libraries integrate with the Spring refresh system, any refresh reloads all configurations from all stores. You can set the refresh interval to any interval longer than 1 second. The supported units for the refresh interval are `s`, `m`, `h`, and `d` for seconds, minutes, hours, and days respectively. The following example sets the refresh interval to 5 minutes:
0 commit comments