在继承了 WebMvcConfigurerAdapter 或 的类重写
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/").addResourceLocations("classpath:/static/"); //访问路径 registry.addResourceHandler("swagger-ui.html") //映射真实路径 .addResourceLocations("classpath:/META-INF/resources/"); //访问路径 registry.addResourceHandler("swagger-ui/index.html") //映射真实路径 .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); }
检查自己的项目是否直接或间接地引入了 SpringSecurity 相关,如果引入
则要添加配置类,继承 WebSecurityConfigurerAdapter,
标签:addResourceHandler,Springboot,classpath,404,META,registry,Swagger,resources,addR From: https://www.cnblogs.com/suBlog/p/17227693.html