1.不用模板默认是webapp,如果要访问resources/templates,static,需要配置spring.resources.static-locations,可以配置绝对路径
2.模板引擎默认是resources/templates,static,也可配置spring.resources.static-locations,可以配置绝对路径
3.拦截器会影响上述默认路径
2.0之前的拦截器WebMvcConfigurerAdapter不会影响上述路径,
2.0之后,WebMvcConfigurerAdapter失效,WebMvcConfigurer和WebMvcConfigurationSupport都会影响上述路径,需要addResourceHandlers添加静态模板路径,可以添加绝对路径,配置文件里的spring.resources.static-locations失效
关于springboot静态资源访问问题总结
最新推荐文章于 2023-02-18 07:00:00 发布