Description
❗ Build Failure due to Private Inner Class in SpringDoc 2.8.6
Description
When using SpringDoc 2.8.6
with Spring Boot AOT (e.g., bootJar
for GraalVM native builds), the build fails with an error related to a private inner class in the SpringDocSpecPropertiesConfiguration
:
error: SpecificationStringPropertiesCustomizerBeanPostProcessor has private access in SpringDocSpecPropertiesConfiguration
Cause
In 2.8.6
, the class:
private static class SpecificationStringPropertiesCustomizerBeanPostProcessor implements BeanPostProcessor
is defined as a private static inner class, which makes it inaccessible to the Spring AOT engine. During AOT processing, Spring attempts to register this class via generated code, but fails due to access restrictions.
Expected Behavior
AOT-generated code must be able to instantiate and register beans. This requires the class to be at least package-private, and ideally public, to ensure compatibility across module boundaries and reflection scenarios.
Suggested Fix
Please update the class definition in SpringDocSpecPropertiesConfiguration.java
from:
private static class SpecificationStringPropertiesCustomizerBeanPostProcessor implements BeanPostProcessor
to:
public static class SpecificationStringPropertiesCustomizerBeanPostProcessor implements BeanPostProcessor
This will resolve the native build/AOT failure and restore compatibility with bootJar
and GraalVM native builds.
How to Reproduce
- Use Spring Boot
3.2.x
with AOT/native image support enabled. - Add SpringDoc dependency (
2.8.6
). - Run:
or
./gradlew bootJar
./mvnw spring-boot:build-image
- Build will fail with the access error above.
Environment
- Spring Boot:
3.2.x
- SpringDoc:
2.8.6
- Build tools: Gradle or Maven with AOT
- Native toolchain: GraalVM or
spring-boot-maven/gradle-plugin