Skip to content

Build Failure due to Private Inner Class #2976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alirezaalj opened this issue May 1, 2025 · 0 comments
Closed

Build Failure due to Private Inner Class #2976

alirezaalj opened this issue May 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@alirezaalj
Copy link

❗ 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

  1. Use Spring Boot 3.2.x with AOT/native image support enabled.
  2. Add SpringDoc dependency (2.8.6).
  3. Run:
    ./gradlew bootJar
    or
    ./mvnw spring-boot:build-image
  4. 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
@bnasslahsen bnasslahsen added the bug Something isn't working label May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants