0
点赞
收藏
分享

微信扫一扫

【Spring Boot】template: “class path resource [templates/admin/main.html]“


【Spring Boot】template: “class path resource [templates/admin/main.html]“_项目结构


今天使用SpringBoot做项目的时候,处理公共页面抽取的时候,出现了上面的错误,搞了好半天,最后发现是路径的问题,代码主要如下:

【Spring Boot】template: “class path resource [templates/admin/main.html]“_html_02


【Spring Boot】template: “class path resource [templates/admin/main.html]“_spring_03

项目结构:

【Spring Boot】template: “class path resource [templates/admin/main.html]“_spring boot_04


在使用thymeleaf 导入公共部分的时候,最初写法:

<div th:include="common :: common_head"></div>

但是默认是到templates目录下找common.html公共页面,而我又创建了一级admin目录,所以默认去找根本找不到,需要改成下面的样式,在指定common的时候添加前级目录:

<div th:include="~{/admin/common :: common_head}"></div>


举报

相关推荐

spring boot admin

Spring Boot Admin

0 条评论