azure - 如何在 Java、Spring 的 azure 应用程序配置中始终加载无标签的功能标志

标签 azure app-config azure-app-configuration feature-flags

我正在使用 azure 应用程序配置来存储我的功能标志。 默认情况下,功能标志根据当前配置文件加载,在 application.yaml 中设置,如下所示:

spring.profile.active 

现在,我的部署环境具有用于开发、预发布和生产的 Azure 应用程序配置的单独实例。

所以,我希望如果我的应用程序在开发环境中运行,那么它应该能够加载无标签和开发标签。就像如果有人只定义了没有标签的键,那么它也应该可以工作并且应该能够获取值。

这可以通过提供以下内容与应用程序配置一起使用:

spring.cloud.azure.appconfiguration.stores[0].selects[0].label-filter: ",${spring.profiles.active}"

但提供相同的功能标志不起作用:

spring.cloud.azure.appconfiguration.stores[0].feature-flags.label-filter:",${spring.profiles.active}"

当 spring.profile.active 有一定值时,任何人都可以建议加载无标签标志的方法吗?

最佳答案

您使用的是哪个版本的库,该配置设置看起来像是旧的。如果您更新到最新版本:

For Spring Framework 2
<dependency>
    <groupId>com.azure.spring</groupId>
    <artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
    <version>4.8.0</version>
</dependency>

For Spring Framework 3
<dependency>
    <groupId>com.azure.spring</groupId>
    <artifactId>spring-cloud-azure-appconfiguration-config</artifactId>
    <version>5.2.0</version>
</dependency>

最新版本支持与配置相同的功能标志加载样式,请参阅此处的最后一个表 https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/spring-cloud-azure-starter-appconfiguration-config#supported-properties

关于azure - 如何在 Java、Spring 的 azure 应用程序配置中始终加载无标签的功能标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76563580/

相关文章:

Azure AD 应用程序权限 : Is it possible to get permissions which comes under "Other permissions granted for tenant"?

Azure 应用程序配置 - 如何设置 secret

database - Azure Cosmos Document DB,可能有关系链接吗?

c# - ConfigurationManager.ConnectionStrings ["aaa"].ConnectionString 将 127.0.0.1 替换为 localhost

azure - Azure 应用程序配置应放置在哪个环境中?

c# - 如何从 app.config 中读取自定义对象列表

c# - App.Config 未更新

Azure Databricks 通过服务主体访问 Azure Data Lake Storage Gen2

azure - 用于扩展的身份列与 GUID

asp.net - 无法通过 Azure Web 应用程序连接到 SQL Server