use of org.thymeleaf.spring6.SpringTemplateEngine in project tutorials by eugenp.
the class ThymeleafConfiguration method templateEngine.
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(thymeleafTemplateResolver());
return templateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project tutorials by eugenp.
the class TestConfig method templateEngine.
@Bean
public SpringTemplateEngine templateEngine() {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
return templateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project irida by phac-nml.
the class IridaApiServicesConfig method exportUploadTemplateEngine.
/*
* Template engine for constructing ncbi export submissions
*/
@Bean(name = "exportUploadTemplateEngine")
public SpringTemplateEngine exportUploadTemplateEngine() {
SpringTemplateEngine exportUploadTemplateEngine = new SpringTemplateEngine();
ClassLoaderTemplateResolver classLoaderTemplateResolver = new ClassLoaderTemplateResolver();
classLoaderTemplateResolver.setPrefix("/ca/corefacility/bioinformatics/irida/export/");
classLoaderTemplateResolver.setSuffix(".xml");
classLoaderTemplateResolver.setTemplateMode(TemplateMode.XML);
classLoaderTemplateResolver.setCharacterEncoding("UTF-8");
exportUploadTemplateEngine.addTemplateResolver(classLoaderTemplateResolver);
return exportUploadTemplateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project gs-spring-security-3.2 by rwinch.
the class WebMvcConfiguration method templateEngine.
@Bean
public SpringTemplateEngine templateEngine(ClassLoaderTemplateResolver templateResolver) {
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver);
templateEngine.addDialect(new TilesDialect());
return templateEngine;
}
use of org.thymeleaf.spring6.SpringTemplateEngine in project thymeleaf-tests by thymeleaf.
the class ContextSequenceTest method testContextSequenceSpring.
public void testContextSequenceSpring() throws Exception {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(new ClassLoaderTemplateResolver());
final Context ctx1 = new Context();
ctx1.setVariable("myObject", new MyObjectClass("one"));
final Context ctx2 = new Context();
ctx2.setVariable("myObject", new MyObjectClass("two"));
final String result1 = ResourceUtils.normalize(templateEngine.process("context/contextSequence.html", ctx1));
final String result2 = ResourceUtils.normalize(templateEngine.process("context/contextSequence.html", ctx2));
final String expected1 = ResourceUtils.read(ClassLoaderUtils.getClassLoader(ContextSequenceTest.class).getResourceAsStream("context/contextSequence-result1.html"), "UTF-8", true);
final String expected2 = ResourceUtils.read(ClassLoaderUtils.getClassLoader(ContextSequenceTest.class).getResourceAsStream("context/contextSequence-result2.html"), "UTF-8", true);
Assert.assertEquals(expected1, result1);
Assert.assertEquals(expected2, result2);
}
Aggregations