Swagger Migration with Springdoc

Jul 17, 2024

Swagger Migration Lecture

Introduction

  • Springfox was used for generating documentation.
  • The need for migration arose, solutions to problems were found, and then documentation was generated anew.

Migration Issues

  • There was a lack of support while using Springfox.
  • Springfox was not supported from Spring Boot 3 onwards.
  • A query on Stack Overflow revealed that currently, Springfox does not support Spring Boot 3.

Solution

  • Suggested using Springdoc instead of Springfox.
  • Advised using the migration guide.

Step-by-Step Migration Process

  1. Removing Springfox and Swagger Dependencies:

    • Remove springfox and swagger 2 dependencies from the project.
    • Add the new springdoc open starter web dependency.
  2. Annotation Changes:

    • Replace Swagger 2 annotations with Swagger 3 annotations.
    • Update various annotations like APIOperation, ApiResponse, ApiParam, etc.
  3. Customization and Property Changes:

    • Create a public class Open API Configuration.
    • Make changes in application.properties.
    • Add @OpenAPIDefinition for basic setup, like title, description, version, etc.
  4. Security:

    • Make v3/api-docs publicly accessible.

Conclusion

  • Project successfully migrated to Springdoc.
  • Swagger documentation is now working with Spring Boot 3.
  • In case of questions or issues, refer to Stack Overflow or the migration guide.

Next Steps

  • Avoid using Springfox until the next update.
  • Improve documentation by presenting the next video.

Notes

  • Mention of video and premium courses: For more information, visit website link.