Reputation: 975
I am using springdoc-open api for swagger integration in my springboot project. I have added below property in application.yml
spring:
mvc:
pathmatch:
matching-strategy: ant_path_mathcher
and added below dependency in build.gralde file
implementation "org.springdoc:springdoc-openapi-ui:1.6.9"
I am able to access /v3/api-docs , but /swagger-ui/index.html and /swagger-ui.html giving 404 Whitelabel Error Page
Upvotes: 2
Views: 8386
Reputation: 975
After googling so many thins, I found a solution to this issue. I had to add an additional configuration class that is OpenApiConfig.java to make it work.
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"org.springdoc"})
@Import({org.springdoc.core.SpringDocConfiguration.class,
org.springdoc.webmvc.core.SpringDocWebMvcConfiguration.class,
org.springdoc.webmvc.ui.SwaggerConfig.class,
org.springdoc.core.SwaggerUiConfigProperties.class,
org.springdoc.core.SwaggerOAuthProperties.class,
org.springframework.autoconfigure.jackson.JacksonAutoConfiguration.class})
class OpenApiConfig implements WebMvcConfigurer {
}
Upvotes: 2