本文整理汇总了Java中org.thymeleaf.spring4.SpringTemplateEngine类的典型用法代码示例。如果您正苦于以下问题:Java SpringTemplateEngine类的具体用法?Java SpringTemplateEngine怎么用?Java SpringTemplateEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpringTemplateEngine类属于org.thymeleaf.spring4包,在下文中一共展示了SpringTemplateEngine类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emailTemplateEngine
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
public TemplateEngine emailTemplateEngine() {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.addTemplateResolver(htmlTemplateResolver());
templateEngine.setTemplateEngineMessageSource(messageSource);
return templateEngine;
}
示例2: MailService
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender,
MessageSource messageSource, SpringTemplateEngine templateEngine) {
this.jHipsterProperties = jHipsterProperties;
this.javaMailSender = javaMailSender;
this.messageSource = messageSource;
this.templateEngine = templateEngine;
}
示例3: CasProtocolView
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
/**
* Instantiates a new Cas protocol view.
*
* @param templateName the template name
* @param applicationContext the application context
* @param templateEngine the template engine
* @param properties the properties
*/
public CasProtocolView(final String templateName, final ApplicationContext applicationContext,
final SpringTemplateEngine templateEngine, final ThymeleafProperties properties) {
super(templateName);
setApplicationContext(applicationContext);
setTemplateEngine(templateEngine);
setCharacterEncoding(properties.getEncoding().displayName());
setLocale(Locale.getDefault());
}
示例4: templateEngine
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
public SpringTemplateEngine templateEngine(){
SpringTemplateEngine engine = new SpringTemplateEngine();
engine.setTemplateResolver(templateResolver());
engine.setEnableSpringELCompiler(true);
return engine;
}
示例5: templateEngine
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
public TemplateEngine templateEngine() {
SpringTemplateEngine engine = new SpringTemplateEngine();
engine.setEnableSpringELCompiler(true);
engine.setTemplateResolver(templateResolver());
return engine;
}
示例6: getTemplateEngine
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
/**
* Bean to configure the template engine
*
* @return the template engine
*/
@Bean(name = "templateEngine")
public SpringTemplateEngine getTemplateEngine() {
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
final Set<IDialect> dialects = new HashSet<>();
dialects.add(new LayoutDialect());
templateEngine.setAdditionalDialects(dialects);
templateEngine.setTemplateResolver(getTemplateResolver());
return templateEngine;
}
示例7: templateEngine
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
@Description("Thymeleaf template engine with Spring integration")
public SpringTemplateEngine templateEngine(final TemplateResolver templateResolver)
throws Exception {
SpringTemplateEngine engine = new SpringTemplateEngine();
engine.setTemplateResolver(templateResolver);
engine.addDialect(new SpringSecurityDialect());
engine.addDialect(new LayoutDialect(new GroupingStrategy()));
engine.afterPropertiesSet();
return engine;
}
示例8: viewResolver
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
@Description("Thymeleaf view resolver")
public ViewResolver viewResolver(final SpringTemplateEngine templateEngine) {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(templateEngine);
resolver.setCharacterEncoding("UTF-8");
resolver.setCache(false);
resolver.setOrder(1);
return resolver;
}
示例9: xmlViewResolver
import org.thymeleaf.spring4.SpringTemplateEngine; //导入依赖的package包/类
@Bean
public ViewResolver xmlViewResolver() {
SpringTemplateEngine engine = xmlTemplateEngine();
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(engine);
viewResolver.setCharacterEncoding("UTF-8"); // Questo è importante anche se nei tutorial non lo mettono
viewResolver.setOrder(10);
// Tutti i template devono stare nel folder /xml. Se non si usa un folder specifico, questo viewResolver non viene usato
viewResolver.setViewNames(new String[] { "/xml/*" }); // E' giusto mettere "*" e non "*.xml" perchè il suffisso viene attaccato grazie al resolver.setSuffix(".xml") di xmlTemplateResolver()
viewResolver.setContentType("text/xml");
// Default is "true": caching is enabled. Disable this only for debugging and development.
viewResolver.setCache(config.isProductionEnvironment());
return viewResolver;
}