From 5a9ccbcfc1be5612c287b3e16bd9b34260818915 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Wed, 19 Dec 2018 01:00:08 +0400 Subject: [PATCH] try to fix template resolvers, step 3 --- .../configuration/MailTemplateConfiguration.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/ru/ulstu/configuration/MailTemplateConfiguration.java b/src/main/java/ru/ulstu/configuration/MailTemplateConfiguration.java index d10e964..3dfac36 100644 --- a/src/main/java/ru/ulstu/configuration/MailTemplateConfiguration.java +++ b/src/main/java/ru/ulstu/configuration/MailTemplateConfiguration.java @@ -17,6 +17,7 @@ public class MailTemplateConfiguration { final SpringTemplateEngine templateEngine = new SpringTemplateEngine(); templateEngine.addTemplateResolver(templateResolver); templateEngine.addTemplateResolver(emailTemplateResolver()); + templateEngine.addTemplateResolver(mvcTemplateResolver()); templateEngine.addDialect(new LayoutDialect()); templateEngine.addDialect(sec); return templateEngine; @@ -32,4 +33,14 @@ public class MailTemplateConfiguration { return emailTemplateResolver; } + public ClassLoaderTemplateResolver mvcTemplateResolver() { + ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver(); + emailTemplateResolver.setPrefix("templates/"); + emailTemplateResolver.setTemplateMode("HTML5"); + emailTemplateResolver.setSuffix(".html"); + emailTemplateResolver.setOrder(2); + emailTemplateResolver.setCharacterEncoding(StandardCharsets.UTF_8.name()); + return emailTemplateResolver; + } + }