• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with documenting Spring Boot 2 REST points please?

 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, let me point out that it appears as though Swagger does not currently support Spring Boot 2.x WebFlux and possibly not with Spring Boot 2.x at all.
I've spend a few hours yesterday and a few hours today trying to find some way to get Swagger to work with my Spring Boot 2 project, which does use WebFlux.

Do you have an automated/programming solution that I could use to help me document the REST end points as I go, which you have used before?
 
Ranch Hand
Posts: 36
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pete,

I would like you to take a look at this, it might have something useful.

-Ankur
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've have tried this before and as soon as I add these lines to my Gradle file
I get the following runtime errors:

Even springframeworkguru noted here https://springframework.guru/spring-boot-restful-api-documentation-with-swagger-2/

springframeworkguru wrote:At this time, WebFlux is not supported.

even though it does support Spring Boot 2.0 M7.
Have you had any experience with this framework?
 
Ankur R Jain
Ranch Hand
Posts: 36
Mac OS X Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Pete Letkeman wrote:
Have you had any experience with this framework?



I have good amount of experience working with Spring Boot 1.5 / Spring framework 4 and Swagger, but unfortunately didn't get chance to start with spring 5/ spring boot 2 specific project.


Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter



Have you tried deleting RequestMappingHandlerAdapter related folders from your local Maven/Gradle repository and trying to re-build project?
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankur R Jain wrote:Have you tried deleting RequestMappingHandlerAdapter related folders from your local Maven/Gradle repository and trying to re-build project?


A) If I did not have these items/entry in my Gradle build file then why would I need to remove files from the cache when I did not have it listed below.
   I did "re-synchronized" the local Gradle setup inside of IntelliJ a few times and I've done a few clean builds before posting to this site.

B) It appears as though using the underlying WebFlux technology does not work with Swagger.
   I've tried may different versions of these files before posting to this site. First I only used then then
   There is not too much of a point in including if a prerequisite library does not load then I do not see the point is adding this line.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It appears as though upgrading to Spring Boot 2.0.0.RC1 does help.
Now there is a problem with this code
Or to be more exact with that code I get runtime errors as listed in previous posts.
However with if I remove the @EnableSwagger2 I do not get those runtime errors.
I've also removed this line from the Gradle build file.

If I cannot use the @EnableSwagger2 annotation then I don't think that I can use Swagger.
I found the above code here http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that Spring REST Docs may be the solution for me.

You can read more about this at the following locations:
  • https://projects.spring.io/spring-restdocs/
  • https://spring.io/guides/gs/testing-restdocs/
  • http://www.baeldung.com/spring-rest-docs
  •  
    reply
      Bookmark Topic Watch Topic
    • New Topic