Open sc-sityad opened 2 weeks ago
I encountered a similar problem. The reason is that I do not use @org.springframework.web.servlet.config.annotation.EnableWebMvc
but define a custom org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
bean. As a result, the org.springdoc.webmvc.ui.SwaggerWebMvcConfigurer
is not applied, I assume because it implements a org.springframework.web.servlet.config.annotation.WebMvcConfigurer
.
By changing the base class from org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
to org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration
the org.springdoc.webmvc.ui.SwaggerWebMvcConfigurer
is applied.
Make sure to delegate to the super class if you override any methods. For example
@Override
public void addResourceHandlers(@Nonnull ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
registry.addResourceHandler("/html/**").addResourceLocations("classpath:/some/path/");
}
See https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/config/annotation/EnableWebMvc.html for more information.
I am using : java : 1.8 springboot: 2.7.15 maven: 3.x springdoc-openapi-ui : 1.7.0 or 1.8.0
I am able to access http://localhost:8000/v3/api-docs and get json response. But not able to access http://localhost:8000/swagger-ui.html
I think it is kind of a bug. I cannot change my java and spring boot version since all the dependencies are set accordingly in my whole project. Can any one tell me why this is happenning?
Error I got in UI: Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback. null There was an unexpected error (type=null, status=null).