Java 布局:装饰不在thymeleaf中解析

Java 布局:装饰不在thymeleaf中解析,java,spring,thymeleaf,Java,Spring,Thymeleaf,我已将以下html标记添加到引用base.html的文件中: <html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{base}" > 当我删除该行时,html呈现良好,但它显然没有导入base.html模板文件。以下是我的项目结构: - resources - templates

我已将以下html标记添加到引用
base.html
的文件中:

<html 
  xmlns:th="http://www.thymeleaf.org" 
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorate="~{base}"
>
当我删除该行时,html呈现良好,但它显然没有导入base.html模板文件。以下是我的项目结构:

- resources
  - templates
    - base.html
    - register.html
最后,我在我的网络配置中添加了以下内容:

private TemplateEngine templateEngine(ITemplateResolver templateResolver) {
    SpringTemplateEngine engine = new SpringTemplateEngine();
    engine.setTemplateResolver(templateResolver);
    engine.addDialect(new LayoutDialect());
    return engine;
}
按如下方式操作:

layout:decorator="base"
请注意,标记名为“decorator”,而不是“decoration”

给你

layout:decorator="base"