Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why Swagger UI is not working in Spring Boot 3.0 version?

I'm trying to run my Spring boot application which is based on version 3.0 with swagger UI and I'm getting a lot of exceptions I have explored many sources like youtube and documentation but I'm unable to find the solution.

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>3.0.0</version>
</dependency>

if any one can share the solution it will be very nice.

like image 242
Rohan Mourya Avatar asked Feb 03 '26 16:02

Rohan Mourya


2 Answers

SpringFox is for all intents and purposes dead / abandoned project. It hasn't has a release since July 2020, note the 3.0.0 is their support for Spring Boot 2.0.0. The breaking API changes, if you haven't already been affected by them in prior releases, have finally broken it for you with the latest Spring Boot 3.0.0 which introduces significant breaking changes in Spring Framework and Spring Boot.

One of which is a change to how Autoconfiguration's must be registered in Spring Boot. The old method was deprecated in 2.7.0 and removed in 3.0.0. Springfox will not work without manually creating the beans required, and this is assuming that there is not more breaking changes in the other Spring components it uses.

There is an alternative in the form of SpringDoc which gives you the same functionality of Springfox's implementation of the OpenAPI / Swagger spec and more.

There is a simple migration guide to move from Springfox to SpringDoc.

like image 79
Darren Forsythe Avatar answered Feb 05 '26 05:02

Darren Forsythe


for spring boot 3 use

<dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
        <version>2.1.0</version>
 </dependency>
like image 20
MM MM Avatar answered Feb 05 '26 06:02

MM MM