use of groovy.text.markup.TemplateConfiguration in project ratpack by ratpack.
the class MarkupTemplateModule method provideTemplateEngine.
@SuppressWarnings("UnusedDeclaration")
@Provides
@Singleton
MarkupTemplateEngine provideTemplateEngine(ServerConfig serverConfig, Config config) {
ClassLoader parent = Thread.currentThread().getContextClassLoader();
TemplateConfiguration effectiveConfiguration = new TemplateConfiguration(config);
// not copied by constructor
effectiveConfiguration.setCacheTemplates(config.isCacheTemplates());
Path templatesDir = serverConfig.getBaseDir().file(config.getTemplatesDirectory());
return new MarkupTemplateEngine(parent, effectiveConfiguration, new CachingTemplateResolver(templatesDir));
}
use of groovy.text.markup.TemplateConfiguration in project spring-framework by spring-projects.
the class GroovyMarkupConfigurerTests method customTemplateConfiguration.
@Test
public void customTemplateConfiguration() throws Exception {
this.configurer.setApplicationContext(this.applicationContext);
this.configurer.setCacheTemplates(false);
this.configurer.afterPropertiesSet();
TemplateEngine engine = this.configurer.getTemplateEngine();
assertThat(engine).isNotNull();
assertThat(engine.getClass()).isEqualTo(MarkupTemplateEngine.class);
MarkupTemplateEngine markupEngine = (MarkupTemplateEngine) engine;
TemplateConfiguration configuration = markupEngine.getTemplateConfiguration();
assertThat(configuration).isNotNull();
assertThat(configuration.isCacheTemplates()).isFalse();
}
use of groovy.text.markup.TemplateConfiguration in project spring-framework by spring-projects.
the class GroovyMarkupConfigurerTests method defaultTemplateEngine.
@Test
public void defaultTemplateEngine() throws Exception {
this.configurer.setApplicationContext(this.applicationContext);
this.configurer.afterPropertiesSet();
TemplateEngine engine = this.configurer.getTemplateEngine();
assertThat(engine).isNotNull();
assertThat(engine.getClass()).isEqualTo(MarkupTemplateEngine.class);
MarkupTemplateEngine markupEngine = (MarkupTemplateEngine) engine;
TemplateConfiguration configuration = markupEngine.getTemplateConfiguration();
assertThat(configuration).isNotNull();
assertThat(configuration.getClass()).isEqualTo(GroovyMarkupConfigurer.class);
}
Aggregations