在spring boot中,一般默认了 static作为静态资源配置,并且该目录下的文件可以通过项目路径直接访问,如:
127.0.0.1:8080/[pName/]/index.html
但是测试却发现必须加上static进行访问,该问题是以下配置引起的,删除即可
spring: mvc: static-path-pattern: /static/**
参考:
在spring boot中,一般默认了 static作为静态资源配置,并且该目录下的文件可以通过项目路径直接访问,如:
127.0.0.1:8080/[pName/]/index.html
但是测试却发现必须加上static进行访问,该问题是以下配置引起的,删除即可
spring: mvc: static-path-pattern: /static/**
参考: