I added swagger-ui
to my spring-boot service application and I've got some error like that when visiting the /swagger-ui/
link.
Error in browser console please see the image(click this link)
My reference in swagger is from here:
https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api
here my sample coode of the configuration:
@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/");
}
}
I tried excluding this part:
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
still no resolve. Hope someone might help. Thank you.