我添加swagger-ui
到我的 spring-boot 服务应用程序中,并且在访问/swagger-ui/
链接时遇到了类似的错误。
我在招摇中的参考来自这里:
https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
这是我的配置示例代码:
@Configuration
public class WebConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoggerInterceptor());
}
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
我尝试排除这部分:
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
还是没有解决。希望有人可以提供帮助。谢谢你。