I need to document my spring boot application's rest apis with SpringDoc OpenApi. So, I added this dependency in my pom.xml:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.8</version>
</dependency>
And here is my config class:
@Configuration
public class SwaggerConfig {
@Bean
public GroupedOpenApi apis() {
return GroupedOpenApi.builder()
.group("my-application")
.packagesToScan("com.myapp.base")
.pathsToMatch("/**")
.build();
}
}
When I want to use swagger-ui in /base-url/swagger-ui/index.html
, the result is as below image:
What's wrong in my configuration?
I use spring boot 2.6.6.
Note: I don't see any problem to load swagger resources in browser console(401, 404). Also I have disabled spring security in app, there is not any problem related to security or loading swagger resources.