Thymeleaf dialect for data attributes
<dependency>
<groupId>com.github.mxab.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-data-attribute</artifactId>
<version>2.0.1</version>
</dependency>
templateEngine.addDialect(new DataAttributeDialect());
<html>
<body data:foo="${'bar'}" data:msg="#{my.message}" >
</body>
</html>
<html>
<body data-foo="bar" data-msg="Your resolved message" >
</body>
</html>
Big shout-out to @dtrunk90 who rewrote everything for Thymeleaf 3.0