[BUG] KeyVaultEnvironmentPostProcessor cannot load configured property-sources in Spring Boot 4 AOT / GraalVM native image
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
Describe the bug
When using Spring Cloud Azure Key Vault Secrets with Spring Boot 4.1.x and GraalVM native image, KeyVaultEnvironmentPostProcessor runs during native/AOT startup before the configured Key Vault property-sources are available in the Environment.
The same configuration works correctly when the application is started normally on the JVM.
During native startup, the processor logs:
KeyVaultEnvironmentPostProcessor : Skip configuring Key Vault PropertySource because spring.cloud.azure.keyvault.secret.property-sources is empty.
However, later during the same application startup, the configuration is present in the Spring Environment:
spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].name=vault
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://example.vault.azure.net/
As a result, the Key Vault PropertySource is never registered and placeholders referring to Key Vault secrets remain unresolved.
For example:
clientSecret=${IClientSecret}
remains the literal value ${IClientSecret} in the native image, whereas on the JVM the secret is resolved correctly.
Exception or Stack Trace
No exception is thrown by KeyVaultEnvironmentPostProcessor.
Instead, during Spring Boot AOT / GraalVM native startup, the processor silently skips Key Vault configuration:
DEBUG KeyVaultEnvironmentPostProcessor :
Skip configuring Key Vault PropertySource because spring.cloud.azure.keyvault.secret.property-sources is empty.
Later during the same startup, the same configuration is present in the Spring Environment:
spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].name=vault
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=https://example.vault.azure.net/
As a consequence, the Key Vault PropertySource is never registered and the secret placeholder remains unresolved:
secretPresent=true
secretLength=15
secretUnresolved=true
For reference, 15 is the length of the unresolved literal:
To Reproduce
Steps to reproduce the behavior:
- Use the following versions:
Spring Boot: 4.1.2
Spring Cloud Azure: 7.4.0
spring-cloud-azure-starter-keyvault-secrets: 7.4.0
azure-identity: 1.18.4
azure-security-keyvault-secrets: 4.11.1
Java: 25
GraalVM Native Image: Java 25
GraalVM Native Build Tools: 1.1.14 - Configure Key Vault Secrets in application.yml:
spring:
cloud:
azure:
keyvault:
secret:
property-source-enabled: true
property-sources:
- name: vault
endpoint: "${KEYVAULT_ENDPOINT}"
- Reference a secret from Key Vault:
insights:
security:
clientSecret: "${IClientSecret}"
- Run the application normally on the JVM.
The Key Vault property source is registered successfully:
PropertySource: vault
(com.azure.spring.cloud.autoconfigure.implementation.keyvault.environment.KeyVaultPropertySource)
The secret is resolved correctly:
secretPresent=true
secretUnresolved=false
- Build and run the same application as a GraalVM native image using Spring AOT.
The native application logs:
Skip configuring Key Vault PropertySource because spring.cloud.azure.keyvault.secret.property-sources is empty.
but later the same properties are visible in the Spring Environment.
We also verified processor ordering:
ConfigDataEnvironmentPostProcessor.getOrder()
= -2147483638
KeyVaultEnvironmentPostProcessor.getOrder()
= -2147483637
The Azure processor is therefore ordered after Spring Boot ConfigData processing.
The native executable also contains the expected Azure spring.factories registration, and KeyVaultEnvironmentPostProcessor is definitely executed.
Code Snippet
Minimal configuration :
spring:
cloud:
azure:
keyvault:
secret:
property-source-enabled: true
property-sources:
- name: vault
endpoint: "${KEYVAULT_ENDPOINT}"
frauscher:
insights:
security:
clientSecret: "${IClientSecret}"
Diagnostic code used to verify the behavior:
println(
"secretUnresolved=" +
securityProperties.clientSecret?.contains("\${")
)
environment.propertySources.forEach {
println("PropertySource: ${it.name} (${it.javaClass.name})")
}
println(
"property-source-enabled=" +
environment.getProperty(
"spring.cloud.azure.keyvault.secret.property-source-enabled"
)
)
println(
"property-sources[0].name=" +
environment.getProperty(
"spring.cloud.azure.keyvault.secret.property-sources[0].name"
)
)
println(
"property-sources[0].endpoint=" +
environment.getProperty(
"spring.cloud.azure.keyvault.secret.property-sources[0].endpoint"
)
)
Expected behavior
The GraalVM native application should behave the same as the JVM application.
KeyVaultEnvironmentPostProcessor should see the configured property-sources, register the Key Vault PropertySource, and resolve Key Vault-backed placeholders at runtime.
The native image should remain environment-independent, with Key Vault endpoint and credentials supplied at deployment/runtime.
Screenshots
Not applicable. Relevant DEBUG output is included above.
Setup (please complete the following information):
- OS: Linux
- IDE: IntelliJ
- Library/Libraries:
Spring Boot: 4.1.2 ,Spring Framework: 7.0.x, Spring Cloud Azure: 7.4.0, spring-cloud-azure-starter-keyvault-secrets:7.4.0, spring-cloud-azure-autoconfigure:7.4.0, Azure Identity: 1.18.4, Azure Key Vault Secrets SDK: 4.11.1, Java: 25, GraalVM Native Image: Java 25 / GraalVM 25.x,
GraalVM Native Build Tools: 1.1.14
- 主要言語
- Java
- スター
- 2.6k
- フォーク
- 2.2k
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 259
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Azure/azure-sdk-for-java のほかの issue
-
mgmt, in track 1 migration guide, call out that file-based authentication method is not recommended再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンAzure.Identity
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
Azure/azure-sdk-for-java#48894 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Azure/azure-sdk-for-java#51237 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Azure/azure-sdk-for-java#51221 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-triage
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
Azure/azure-sdk-for-java#51215 · コメント 1 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] IllegalStateException when cancelling Service Bus session acquisition on a Reactor threadオープンClient customer-reported needs-team-attention question Service Attention Service Bus
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
Azure/azure-sdk-for-java#51213 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
Azure/azure-sdk-for-java の issue をすべて見る
似ている issue
-
bug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration対応中かも @amalsaidov が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
area/ai area/backend component/zeebe kind/task
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信