需要在Swagger2Config类

addResourceHandlers方法

中添加

 

registry.addResourceHandler("/**")
.addResourceLocations("classpath:/resources/")
.addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/public/");