Generating Swagger JSON for Spring MVC: Springfox or Enunciate

If you want to create Swagger UI documentation for your Spring MVC project, you basically have two options: Enunciate and SpringFox.

I dived into the topic, but couldn't find a single opinion which is better.

Enunciate looks preferable from my point of view as it completely breaks your project. No need to add custom Beans with configuration, no need to reference an additional annotation package and annotate their controllers. You just use JavaDoc with custom tags and it does the job.

Are there any other considerations?

Thank.

+3


source to share


1 answer


After using both, I found the following key differences:



  • Evaluates annotations at build time, Springfox reads Spring MVC configuration from application context (build time and runtime)
  • Enunciate can use Javadocs as part of the documentation (build vs. runtime)
  • Springfox requires a test to generate a swagger configuration file that can be used to further generate code that is not suitable for the standard maven lifecycle. I prefer to use generate-sources

    / generate-resources

    to generate code for / doc. With springfox, I am stuck with build after running tests.
  • Springfox c springfox-swagger-ui

    is a really easy way to dock a swagger UI on top of an existing Spring Boot / MVC application. OTOH, using something like ReDoc along with the generated Swagger Spec is almost as simple, but more flexible.
  • Springfox requires a fairly specific configuration in your application, so your application will have a dependency on the Springfox behavior.
+1


source







All Articles