Skip to content

Commit 3639734

Browse files
authored
Merge pull request #217446 from mrm9084/SpringLabelsFAQ
App Config Spring Profiles F.A.Q.
2 parents 82bd36d + 80c1395 commit 3639734

File tree

1 file changed

+23
-0
lines changed
  • articles/azure-app-configuration

1 file changed

+23
-0
lines changed

articles/azure-app-configuration/faq.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,30 @@ sections:
145145
Yes. While you can manage feature flags and Key Vault references in App Configuration through the Azure portal or CLI, you can also create and update them programmatically using App Configuration SDKs. Therefore, you can write your customized management portal or manage them in your CI/CD programmatically. The feature flag and Key Vault reference APIs are available in SDKs of all supported languages. Check out the [sample links](https://github.com/Azure/AppConfiguration#sdks) for examples in each supported language.
146146
147147
Evaluating and consuming feature flags in your application requires the App Configuration provider and feature management libraries, which are available in .NET and Java Spring. Check out the _Feature management_ section under _Quickstarts_ and _Tutorials_ for more information.
148+
149+
- question: How to use Java Spring profiles in App Configuration?
150+
answer: |
151+
Spring profiles provide a way to separate parts of your application, including configuration, and make it only available in certain environments or when specific libraries are used.
152+
153+
You are recommended to set the label of your key-values to match your Spring profiles. By default, the App Configuration Spring provider library will load the key-values with the label(s) matching the current active Spring profile(s) (`${spring.profiles.active}`) if the label filter isn't set explicitly. If there is no active Spring profile set, key-values with "no label" will be loaded.
154+
155+
For example, with profiles `dev` and `prod`, you create key-values accordingly with the following labels.
156+
157+
| Key | Label | Value |
158+
| --- | ----- | ----- |
159+
| /application/config.message | dev | Hello from dev |
160+
| /application/config.message | prod | Hello from prod |
161+
162+
When the Spring profile is set to `dev`, the value of `config.message` will be `Hello from dev`. When the Spring profile is set to `prod`, the value of `config.message` will be `Hello from prod`.
163+
164+
This default behavior can be overridden by setting the label filter in your bootstrap file. The Spring provider library will load key-values with the specified label(s) regardless of the active Spring profile.
165+
166+
```yaml
167+
spring.cloud.azure.appconfiguration.stores[0].selects[0].label-filter: my-label
168+
```
148169
170+
To select other labels and your Spring profile(s), you can use selects like `',${spring.profiles.active}'` which will select all keys without a label and the ones matching your Spring profiles. The rightmost label(s) take priority when duplicate keys are found.
171+
149172
- question: How can I receive announcements on new releases and other information related to App Configuration?
150173
answer: |
151174
Subscribe to our [GitHub announcements repo](https://github.com/Azure/AppConfiguration-Announcements).

0 commit comments

Comments
 (0)