Springboot遇到的坑
大姑娘绣鸳鸯
这个作者很懒,什么都没留下…
展开
-
thymeleaf包引入了,SpringBoot依旧无法解析templates目录下的文件
如题,尝试了几种方法,有加配置项:spring.resources.static-locations=classpath:/templates/;有的修改名称,还有的自定义配置类,都不行;后来对比了之前写的项目发现thymeleaf的包引用顺序和web引用顺序当前的不一致,改变下顺序就行了!之前的:之后的:...原创 2021-06-07 10:28:33 · 434 阅读 · 0 评论 -
Springboot项目导入了thymeleaf模板,启动仍然无法访问static下面的资源
Springboot项目导入了thymeleaf模板,启动仍然无法访问static下面的资源原因:SpringBoot2.0后不支持访问static下的文件解决方法:需要自定义配置文件代码如下(2.0版本后使用WebMvcConfigurer可以来扩展SpringMVC的功能):@Configurationpublic class MyMvcConfig implements WebMvcConfigurer { @Override public void addResourceH原创 2021-04-12 22:26:49 · 440 阅读 · 0 评论