Swagger UI issue with Spring Boot 3 - spring

Getting this error:
500 Server Error for HTTP GET "/v3/api-docs/my-service" java.lang.IllegalArgumentException: Required attribute 'org.springframework.cloud.gateway.support.ServerWebExchangeUtils.gateway.observation' is missing
while trying to access API docs from Swagger UI.
I'm using the following:
implementation "org.springdoc:springdoc-openapi-starter-webflux-ui:2.0.2"
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-api:2.0.2'

Spring boot 3.0 have some known issues with swagger ui
in your dependencies change the spring boot version to 2.5.7
Refresh you import and it should work

Related

Swagger UI is Hangs with spring boot API

We are using Spring boot 2.6 and Swagger UI for the rest APIs, initially, it works perfectly but when the controller and model object increase it's started hanging the swagger UI.

Spring Boot - What is the new Property Name for `management.endpoint.env.post.enabled`

I'm trying to enable the use of POST requests via Spring Boot Actuator using spring-boot-starter-parent with version 2.3.2.RELEASE and the latest 2.4.3 release.
I'm currently getting a 405 error response with "Method Not Allowed" and a message of "Request Method 'POST' not supported". From some googling it looks like Spring Boot v2.2.4 introduced the management.endpoint.env.post.enabled which needed to be set to true to allow posts but that no longer seems to be recognized in Spring Boot 2.3.2. Has this property been renamed?

Spring Data Rest links incorrect after upgrading to spring boot 2.1.0.RELEASE

After upgrading the spring boot starter parent from 2.0.6.RELEASE to 2.1.0.RELEASE, the links generated by spring data rest no longer have the host of the UI but instead have the host of the API microservice. Is there an application property or setting that needs to be added.
I compared the request headers of the request when using each of the versions and they haven't changed while checking if may have been causing the issue.
I noticed that in the 'getting started' guide for rest hateoas
Spring HATEOAS respects various X-FORWARDED- headers
But I never set those headers in the previous version. Should those be added.

Spring Boot WebFlux remove Whitelabel

I am testing the new WebFlux framework and I would like to remove the default error view (Whitelabel Error Page). I have noticed that the default server for this framework is Netty and that it seems not to respond to the old server.error.whitelabel.enabled=false.
Is there any other way or am I doing something wrong?
This is a bug and it will be fixed in Spring Boot 2.0.1.RELEASE, see gh-12520.
In the meantime, you could:
exclude completely the ErrorWebFluxAutoConfiguration if you don't want any Spring Boot error handling support
add a error template/static file in your application to override the default view
Note that once it's supported (and without applying the other options I've just listed), your application will just send a raw HTTP error response (i.e. not a JSON response). Is that what you intend to have?

How to generate WADL for Spring REST Service

Hi I am working with Spring 3.5.0.Release. I want to generate a WADL for my spring rest service. Is their any functionality in Spring by which i can easily generate the WADL.
You can use Swagger-SpringMVC, which will automatically integrate Swagger compliant API-docs into your application.
Version 1.0.2 is stable and supports Swagger 1.2.
Version 2.0.0 is currently under development and will support Swagger 2.0.
The api-docs will be accessible using
http://localhost:8080/api-docs
then.
https://github.com/springfox/springfox
You can also use Swagger-UI to access the API-docs and you can generate the client code using Swagger-Codegen.

Resources