Bug description
Building a Spring Boot application as a GraalVM Native Image fails when azure-core is on the runtime classpath. The failure reproduces after removing Azure Monitor/OpenTelemetry entirely; the application still uses Azure Blob Storage, Azure Identity, and Azure Communication Email.
azure-core's META-INF/native-image/com.azure/azure-core/native-image.properties forces org.slf4j.LoggerFactory and com.azure.core.util.logging.ClientLogger to initialize at build time. During native-image analysis, a static initializer such as com.azure.core.util.ExpandableStringEnum.<clinit> creates a ClientLogger. SLF4J then has SubstituteServiceProvider and NOP_FallbackServiceProvider objects in the image heap, but those types are configured for runtime initialization.
Versions
- Spring Boot: 4.1.0
- Java: 25
- GraalVM Native Image:
- Oracle GraalVM 25.0.3+9.1 in GitHub Actions
- GraalVM Community 25.0.2+10.1 locally (same failure)
azure-core: 1.58.1
- Azure SDKs on the classpath:
azure-storage-blob 12.35.0
azure-identity 1.18.4
azure-communication-email 1.1.4
Reproduction
- Create a Spring Boot 4.1 application with the Azure SDK dependencies above.
- Apply
org.graalvm.buildtools.native.
- Run
./gradlew nativeCompile with GraalVM 25.
The failure is reproducible both locally in a Linux Docker build and in GitHub Actions.
Actual result
Native image analysis fails:
Fatal error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException:
An object of type 'org.slf4j.helpers.SubstituteServiceProvider' was found in the image heap.
This type, however, is marked for initialization at image run time.
Object was reached by
org.slf4j.LoggerFactory.getProvider(...)
org.slf4j.LoggerFactory.getLogger(...)
com.azure.core.util.logging.ClientLogger.getLogger(...)
com.azure.core.util.logging.ClientLogger.<init>(...)
com.azure.core.util.ExpandableStringEnum.<clinit>(...)
The same build also reports org.slf4j.helpers.NOP_FallbackServiceProvider.
Expected result
azure-core should support native-image builds with current Spring Boot / SLF4J 2 / GraalVM 25, or its native-image metadata should avoid forcing SLF4J initialization in a way that creates a fallback provider in the image heap.
Notes
- Explicitly setting
--initialize-at-run-time=org.slf4j.LoggerFactory conflicts with the build-time rule from azure-core's native-image.properties.
- Forcing the fallback providers to build time may allow the build to progress, but appears unsafe because it can freeze SLF4J's NOP fallback into the executable.
- We would appreciate recommended GraalVM arguments or an updated native-image metadata configuration.
Bug description
Building a Spring Boot application as a GraalVM Native Image fails when
azure-coreis on the runtime classpath. The failure reproduces after removing Azure Monitor/OpenTelemetry entirely; the application still uses Azure Blob Storage, Azure Identity, and Azure Communication Email.azure-core'sMETA-INF/native-image/com.azure/azure-core/native-image.propertiesforcesorg.slf4j.LoggerFactoryandcom.azure.core.util.logging.ClientLoggerto initialize at build time. During native-image analysis, a static initializer such ascom.azure.core.util.ExpandableStringEnum.<clinit>creates aClientLogger. SLF4J then hasSubstituteServiceProviderandNOP_FallbackServiceProviderobjects in the image heap, but those types are configured for runtime initialization.Versions
azure-core: 1.58.1azure-storage-blob12.35.0azure-identity1.18.4azure-communication-email1.1.4Reproduction
org.graalvm.buildtools.native../gradlew nativeCompilewith GraalVM 25.The failure is reproducible both locally in a Linux Docker build and in GitHub Actions.
Actual result
Native image analysis fails:
The same build also reports
org.slf4j.helpers.NOP_FallbackServiceProvider.Expected result
azure-coreshould support native-image builds with current Spring Boot / SLF4J 2 / GraalVM 25, or its native-image metadata should avoid forcing SLF4J initialization in a way that creates a fallback provider in the image heap.Notes
--initialize-at-run-time=org.slf4j.LoggerFactoryconflicts with the build-time rule fromazure-core's native-image.properties.