use of org.thymeleaf.spring6.SpringTemplateEngine in project zhcet-web by zhcet-amu.
the class TemplateConfig method emailTemplateEngine.
@Bean(name = "extraTemplateEngine")
public TemplateEngine emailTemplateEngine() {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
// Resolver for TEXT
templateEngine.addTemplateResolver(textTemplateResolver());
// Resolver for HTML
templateEngine.addTemplateResolver(htmlTemplateResolver());
// Resolver for JS
templateEngine.addTemplateResolver(jsTemplateResolver());
// Resolver for HTML (editable) as string
templateEngine.addTemplateResolver(stringTemplateResolver());
return templateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project thymeleaf-tests by thymeleaf.
the class OfflineTest method testOfflineSpring01.
@Test
public void testOfflineSpring01() throws Exception {
final Context ctx = new Context();
ctx.setVariable("one", "This is one");
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(new ClassLoaderTemplateResolver());
final String result = templateEngine.process("offline/offlinespring01.html", ctx);
final String expected = ResourceUtils.read(ClassLoaderUtils.getClassLoader(OfflineTest.class).getResourceAsStream("offline/offlinespring01-result.html"), "UTF-8", true);
Assert.assertEquals(expected, ResourceUtils.normalize(result));
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project tutorials by eugenp.
the class ClientWebConfig method templateEngine.
@Bean
@Description("Thymeleaf template engine with Spring integration")
public SpringTemplateEngine templateEngine() {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
final Set<IDialect> dialects = new HashSet<>();
dialects.add(new CustomDialect());
templateEngine.setAdditionalDialects(dialects);
return templateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project tutorials by eugenp.
the class WebMVCConfig method templateEngine.
private TemplateEngine templateEngine(ITemplateResolver templateResolver) {
SpringTemplateEngine engine = new SpringTemplateEngine();
engine.addDialect(new LayoutDialect(new GroupingStrategy()));
engine.addDialect(new Java8TimeDialect());
engine.setTemplateResolver(templateResolver);
engine.setTemplateEngineMessageSource(messageSource());
return engine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project irida by phac-nml.
the class WebEmailConfig method emailTemplateEngine.
@Bean
public SpringTemplateEngine emailTemplateEngine() {
SpringTemplateEngine emailTemplateEngine = new SpringTemplateEngine();
emailTemplateEngine.addTemplateResolver(classLoaderTemplateResolver());
return emailTemplateEngine;
}
Aggregations