Skip to content

Build Failure due to Private Inner Class #2976

Closed
@alirezaalj

Description

@alirezaalj

❗ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions