我在 Spring Boot 2 中使用 Pebble 模板引擎,在我开始使用继承之前一切正常。浏览器显示一个空白页面,根本没有返回任何内容。不幸的是,服务器和 Catalina(我使用的是 Tomcat 8.5)日志显示没有错误。
在我的 pom 中,我有以下依赖项:
- Spring Boot 2.0.3(作为父级)
- pebble-spring-boot-2-starter(试过 2.6.2 和 3.0.0.BETA01)
- spring-boot-starter-数据-jpa
- spring-boot-starter-web
- spring-boot-starter-安全
我有以下 application.properties
- pebble.suffix = .html.peb
- pebble.cache = false(也试过了)
我的父模板 (resources/templates/base.html.peb)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head></head>
<body>Template test</body>
</html>
我的子模板 (resources/templates/child.html.peb)
{% extends "base.html.peb" %}
当我删除继承时,Pebble 工作正常,并且包含并显示模型,所以 Pebble 确实可以工作。