Description
I mark a rest controller class as hidden (with @hidden annotation) to skip it while reading, but this have no affect.
This behavior is due to original class name wrapped into proxy by Spring boot default proxying mechanism CGLIB, so class name followed by "$$SpringCGLIB$$0" suffix.
See code:
https://github.com/springdoc/springdoc-openapi/blob/71a0684dc0eea2504f570aad90f5069319dfa061/springdoc-openapi-starter-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java#L303
public static boolean isHiddenRestControllers(Class<?> rawClass) { return HIDDEN_REST_CONTROLLERS.stream().anyMatch(clazz -> clazz.isAssignableFrom(rawClass)); }
The Solution is to get real class name, for example:
org.springframework.util.ClassUtils.getUserClass(clazz).isAssignableFrom(rawClass)
- spring-boot 3.2.4
- springdoc-openapi-starter-common 2.6.0
- The expected result is not to have controller with @hidden annotation in the openapi documentation.