I am trying to use Springdoc v2 with Spring Boot 3. It works fine when running it with the JVM, but not when running the native binary.
The Spring boot project is created like this: https://start.spring.io/#!type=maven-project&language=java&platformVersion=3.0.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=native,web,lombok
I've added the Springdoc dependency:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
Starting the jar file, I can browse http://localhost:8080/swagger-ui/index.html, but when I run the native binary, I get a 404.
According to the documentation, it seems to support it out of the box: https://springdoc.org/v2/
You are using correct dependency
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.0</version>
</dependency>
but missing the property below
springdoc.enable-native-support=true
springdoc.swagger-ui.path=/swagger-ui
here the working example. After build you can see swagger ui working at http://localhost:8080/swagger-ui which will redirect to http://localhost:8080/swagger-ui/4.15.5/index.html