I have missed about 30 minutes trying to figure out how to generate HTML body from my email service. This is a scheduled task, not an API call - means no controllers or MVC app logic. Just process template.
I have raw java and I want to process single *.html file with Thymeleaf. How to do that?
In other words, I need Thymeleaf analogy for Velocity example:
VelocityEngine ve = new VelocityEngine();
ve.init();
Template t = ve.getTemplate( "helloworld.vm" );
VelocityContext context = new VelocityContext();
context.put("name", "World");
StringWriter writer = new StringWriter();
t.merge( context, writer );
P.S. I've read this issue, it doesn't provide an answer. Both Thymeleaf doc and thymeleafexamples-gtvg are bound to controller logic, resolvers and other stuff I do not need.
In thymeleaf 3 the solution is very similar:
and finally the code: