-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
Actual example found here does not work for me.
@Bean
public SpringTemplateEngine templateEngine(){
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setEnableSpringELCompiler(true);
templateEngine.setTemplateResolver(templateResolver());
templateEngine.addDialect(new HelloDialect());
return templateEngine;
}Problems:
- templateResolver() not implemented.
- Other dialects like for exanple "thymeleaf-layout-dialect" don't work any more.
My Fix
@Bean
public SpringTemplateEngine templateEngine(ClassLoaderTemplateResolver templateResolver, ObjectProvider<IDialect> dialects){
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setEnableSpringELCompiler(true);
templateEngine.setTemplateResolver(templateResolver);
dialects.orderedStream().forEach(templateEngine::addDialect);
templateEngine.addDialect(new HelloDialect());
return templateEngine;
}Metadata
Metadata
Assignees
Labels
No labels