springboot访问resources下的资源文件

项目的目录结构如下:

实现 WebMvcConfigurer接口,重写 addResourceHandlers方法即可:

如果配置了上下文,那么就需要在访问路径相对应的加上:

so,我的test.html的访问路径是:http://localhost:8090/task/pages/test.html,并且它会自动跳转到百度

posted @ 2020-01-15 15:14  len_清水白  阅读(3199)  评论(0)    收藏  举报