admin管理员组

文章数量:1122832

My springboot app with swagger runs fine when I run it as as springboot app.

There is another way to run my spring boot app, through the springboot JarLauncher class. I upgraded my springboot jars from 3.1.x to 3.3.x and this jarlauncher was moved to a different package but the good guys at spring still brought back the original package (in later versions). So after upgrading the versions, my springboot app didn't run, turns out it was the JarLauncher class.

So We can switch to the classic JarLauncher class by a maven setting.

the app now runs but the Swagger Ui page does not list any operations. it just says No operations definde in Spec!. There are many threads with the same error message but I have tried almost all of them.

My annotation on my rest controller is @RestController and not @Controller.

I have tried to change the @GetMapping to @RequestMapping(method=RequestMethod.GET)

I have tried to remove the springdoc.packageToScan property, changed it to com.my.project.v1 or com.my.project.v1.* as my rest endpoints reside in com.my.project.v1.endpoints.rest package,

added rest endpoints in v1 folder, or in endpoints folder as well.

I used application.yaml and even application.properties ( just in case yaml was being an issue for some reason).

when I go to localhost:8080/v3/api-docs, my paths and components are empty {}.

before the upgrade it was working fine. after the upgrade, I am only forcing the system to use the classic JarLauncher class. after the upgrade it works fine if i run it as a springboot app and/or on Docker.

my controller has three annotaions:

 @RestController
    @validated
    @RequestMapping("/api/v1")
    public class MyController{
    
    @GetMapping(value="/my-endpoint")
    public Object getEndpoint(){
    }
}

What would I be missing?

my libs org.springdoc 2.6.0 io.swagger.core.v3 2.29 Springboot 3.3.3

本文标签: javaSwagger UI does not show operations when running with classic JarLauncherStack Overflow