-
-
Notifications
You must be signed in to change notification settings - Fork 553
Description
Here’s a well-structured bug report you can submit to the springdoc-openapi GitHub repository:
Bug Report: Private Inner Class SpecificationStringPropertiesCustomizerBeanPostProcessor Inaccessible During AOT/Native Compilation
Description
When building a GraalVM native image with springdoc-openapi (v2.5.0+) and Spring Boot 3.x, the AOT compiler fails with the following error:
/build/generated/aotSources/org/springdoc/core/configuration/SpringDocSpecPropertiesConfiguration__BeanDefinitions.java:48: error: SpecificationStringPropertiesCustomizerBeanPostProcessor has private access in SpringDocSpecPropertiesConfiguration
private static BeanInstanceSupplier<SpringDocSpecPropertiesConfiguration.SpecificationStringPropertiesCustomizerBeanPostProcessor> getSpecificationStringPropertiesCustomizerBeanPostProcessorInstanceSupplier(
The issue occurs because the AOT-generated code cannot access the private inner class SpecificationStringPropertiesCustomizerBeanPostProcessor in SpringDocSpecPropertiesConfiguration.
Steps to Reproduce
-
Environment:
- Spring Boot:
3.4.4 - SpringDoc OpenAPI:
2.5.0(or2.8.6) - GraalVM Native:
openjdk version "21.0.2" 2024-01-16 OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30) OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing) - Java:
21
- Spring Boot:
-
Reproduction Steps:
- Create a Spring Boot 3.x project with
springdoc-openapi-starter-webmvc-ui. - Enable GraalVM native image compilation (
org.graalvm.buildtools.native). - Run:
./gradlew nativeCompile
- Result: Build fails with the above error.
- Create a Spring Boot 3.x project with
-
Minimal Test Case:
@SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
(No explicit OpenAPI config needed—fails with default setup.)
Expected Behavior
-
The native image compilation should succeed, as
springdoc-openapishould support Spring AOT and GraalVM native builds. -
The
SpecificationStringPropertiesCustomizerBeanPostProcessorshould either be public or use a different mechanism for AOT compatibility. -
Impact:
- Blocks native image adoption for projects using
springdoc-openapi.
- Blocks native image adoption for projects using
Request
- Could the
SpecificationStringPropertiesCustomizerBeanPostProcessorbe made public or modified for AOT compatibility? - Alternatively, could an official GraalVM native image hint be provided?