application.yml配置
#thymeleaf模板配置
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
cache: false #热部署文件,false页面不产生缓存,及时更新,true开启缓存
messages:
basename: messages/demo #指定外部属性文件
demo.properties(放到classpath:/messages/文件下)
global.welcome=默认欢迎显示
index.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Thymeleaf Demo演示页面</title>
</head>
<body>
<p th:text="#{global.welcome}">welcome to my demo page</p>
</body>
</html>