本文整理匯總了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;
}