Forum Discussion

joecrocker's avatar
New Contributor
6 years ago

Does swagger-gradle-plugin work with Spring MVC? Or only JAX-RS?

I have an existing spring boot application using Swagger 1.5 annotations. The gradle plugin I was using to generate swagger docs no longer works. So I noticed swagger-core now provides a gradle plugin. I see it only supports Swagger 2 annotation so I converted the 1.x annotations to 2.x. That went smoothly. However, no matter what I do all I get is a file whose sole contents is:


openapi: 3.0.1

I notice the documentation mentions a lot about JAX-RS and seems to trigger off @PATH  or @GET/POST annotations. However, I have spring MVC annotations so don't have JAX-RS annotations. I do however have the swagger 2.0 annotations. So do I have to have JAX-RS annotations before the swagger-gradle-plugin will generate the documentation?

I don't want to use springfox, I simply want a static yml file with the api docs in it.


EDIT: I tried adding an OpenAPIDefinition annotation to my controller, and that was added to my yml file. So the controller is definitely being examined; however, none of my operations are being added to the generated yml file.

2 Replies

  • swagger-gradle-plugin indeed wraps swagger-jaxrs2 which supports resolving of JAX-RS; atm spring annotations are not supported.

    • joecrocker's avatar
      New Contributor

      So if there are swagger specific annotations why the dependency on JAX-RS? Why not just generate the doc based on the exitence of the swagger annotations? Then it would be framework agnostic.