-
-
Notifications
You must be signed in to change notification settings - Fork 528
Cannot override OpenApiResource autoconfiguration #608
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
Comments
I see that OpenApiResource has @ConditionalOnBean directly annotated on it, and I see this in Spring Boot ConditionalOnBean java docs
Maybe we need to remove it from the class itself? |
Hi @jryan128, In fact you can override by type. But not using bean name. @RestController("openApiResource")
public class MyOpenApiResource extends OpenApiResource {
public MyOpenApiResource(OpenAPIBuilder openAPIBuilder, AbstractRequestBuilder requestBuilder, GenericResponseBuilder responseBuilder, OperationBuilder operationParser, RequestMappingInfoHandlerMapping requestMappingHandlerMapping, Optional<List<OpenApiCustomiser>> openApiCustomisers, SpringDocConfigProperties springDocConfigProperties) {
super(Constants.DEFAULT_GROUP_NAME, openAPIBuilder, requestBuilder, responseBuilder, operationParser, requestMappingHandlerMapping, openApiCustomisers, springDocConfigProperties);
}
@Operation(hidden = true)
@GetMapping(value = API_DOCS_URL, produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, @Value(API_DOCS_URL) String apiDocsUrl)
throws JsonProcessingException {
return Mono.just("ok");
}
@Operation(hidden = true)
@GetMapping(value = DEFAULT_API_DOCS_URL_YAML, produces = APPLICATION_OPENAPI_YAML)
public Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest,
@Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl) throws JsonProcessingException {
return Mono.just("ok");
}
} And with the next release, you can just use @RestController |
Uh oh!
There was an error while loading. Please reload this page.
I see that SpringDocWebFluxConfiguration has @ConditionalOnMissingBean and @ConditionalOnProperty set, but when I set the property to false, or provide a bean spring still complains:
Using Spring Boot 2.2.6
Spring Doc 1.3.4
Thank you!
The text was updated successfully, but these errors were encountered: