Search in sources :

Example 21 with SpringTemplateEngine

use of org.thymeleaf.spring4.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;
}
Also used : SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) Bean(org.springframework.context.annotation.Bean)

Example 22 with SpringTemplateEngine

use of org.thymeleaf.spring4.SpringTemplateEngine in project yqq by yeycfri.

the class WebConfig method viewResovler.

@Bean
public ViewResolver viewResovler(SpringTemplateEngine templateEngine) {
    ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
    viewResolver.setTemplateEngine(templateEngine);
    return viewResolver;
}
Also used : ThymeleafViewResolver(org.thymeleaf.spring4.view.ThymeleafViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 23 with SpringTemplateEngine

use of org.thymeleaf.spring4.SpringTemplateEngine in project Flare-event-calendar by PollubCafe.

the class ThymeleafConfig method springTemplateEngine.

@Bean
public SpringTemplateEngine springTemplateEngine() {
    SpringTemplateEngine templateEngine = new SpringTemplateEngine();
    templateEngine.addTemplateResolver(htmlTemplateResolver());
    return templateEngine;
}
Also used : SpringTemplateEngine(org.thymeleaf.spring4.SpringTemplateEngine) Bean(org.springframework.context.annotation.Bean)

Example 24 with SpringTemplateEngine

use of org.thymeleaf.spring4.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;
}
Also used : SpringTemplateEngine(org.thymeleaf.spring4.SpringTemplateEngine) CustomDialect(com.baeldung.dialect.CustomDialect) IDialect(org.thymeleaf.dialect.IDialect) HashSet(java.util.HashSet) Description(org.springframework.context.annotation.Description) Bean(org.springframework.context.annotation.Bean)

Example 25 with SpringTemplateEngine

use of org.thymeleaf.spring4.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;
}
Also used : SpringTemplateEngine(org.thymeleaf.spring4.SpringTemplateEngine) GroupingStrategy(nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy) LayoutDialect(nz.net.ultraq.thymeleaf.LayoutDialect) Java8TimeDialect(org.thymeleaf.extras.java8time.dialect.Java8TimeDialect)

Aggregations

SpringTemplateEngine (org.thymeleaf.spring5.SpringTemplateEngine)15 Bean (org.springframework.context.annotation.Bean)13 SpringTemplateEngine (org.thymeleaf.spring4.SpringTemplateEngine)13 Test (org.junit.Test)11 ClassLoaderTemplateResolver (org.thymeleaf.templateresolver.ClassLoaderTemplateResolver)10 ArrayList (java.util.ArrayList)7 Context (org.thymeleaf.context.Context)6 ITemplateResolver (org.thymeleaf.templateresolver.ITemplateResolver)6 ThymeleafViewResolver (org.thymeleaf.spring4.view.ThymeleafViewResolver)3 DefaultTemplateResolver (org.thymeleaf.templateresolver.DefaultTemplateResolver)3 FileTemplateResolver (org.thymeleaf.templateresolver.FileTemplateResolver)3 StringTemplateResolver (org.thymeleaf.templateresolver.StringTemplateResolver)3 TemplateEngine (org.thymeleaf.TemplateEngine)2 CustomDialect (com.baeldung.dialect.CustomDialect)1 InstanceRepository (de.codecentric.boot.admin.server.domain.entities.InstanceRepository)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1