springboot静态资源目录的使用

寻早静态资源的默认目录是resources/**,但是如果你想加一个前缀才能搜索的话,在yaml中就要换个方式书写

spring:
    mvc:
        static-path-pattern: /res/**

这样就戴上了前缀  总路径就是:当前项目+static-path-pattern+静态资源名=静态资源文件夹下找,注意 这样不修改实际路径

resources:
   static-locations: classpath:/shuaichao

这样的话   能被扫描的路径就被改成了resources下的帅超文件夹的内容  但是现在新版本已经弃用了

posted @ 2021-12-31 09:36  帅超007  阅读(162)  评论(0编辑  收藏  举报