本文整理匯總了Java中org.thymeleaf.templateresolver.ClassLoaderTemplateResolver.setOrder方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassLoaderTemplateResolver.setOrder方法的具體用法?Java ClassLoaderTemplateResolver.setOrder怎麽用?Java ClassLoaderTemplateResolver.setOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.thymeleaf.templateresolver.ClassLoaderTemplateResolver
的用法示例。
在下文中一共展示了ClassLoaderTemplateResolver.setOrder方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: yadaTemplateResolver
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //導入方法依賴的package包/類
@Bean
public ClassLoaderTemplateResolver yadaTemplateResolver() {
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
// Relative paths never work, with or without trailing slash, so better to be consistent without and always use "absolute" paths [xtian]
resolver.setPrefix(YadaConstants.YADA_VIEW_PREFIX); // Attenzione allo slash finale!
// resolver.setPrefix(YadaConstants.YADA_VIEW_PREFIX + "/"); // Attenzione allo slash finale!
/* From the tutorial:
When several template resolvers are applied, it is recommended to specify patterns
for each template resolver so that Thymeleaf can quickly discard those template resolvers
that are not meant to resolve the template, enhancing performance. Doing this is not a
requirement, but a recommendation
*/
Set<String> patterns = new HashSet<>();
patterns.add("/yada/*"); // Start with "yada"
resolver.setResolvablePatterns(patterns);
resolver.setSuffix(".html");
resolver.setCharacterEncoding("UTF-8");
resolver.setTemplateMode(TemplateMode.HTML);
resolver.setCacheable(config.isProductionEnvironment());
resolver.setOrder(10);
return resolver;
}
示例2: templateEngine
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //導入方法依賴的package包/類
@Bean
public SpringTemplateEngine templateEngine() {
SpringTemplateEngine mock = spy(SpringTemplateEngine.class);
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(2);
templateResolver.setResolvablePatterns(Collections.singleton("html/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(TemplateMode.HTML);
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
mock.addTemplateResolver(templateResolver);
final ClassLoaderTemplateResolver templateResolverTxt = new ClassLoaderTemplateResolver();
templateResolverTxt.setOrder(1);
templateResolverTxt.setResolvablePatterns(Collections.singleton("text/*"));
templateResolverTxt.setPrefix("/mail/");
templateResolverTxt.setSuffix(".txt");
templateResolverTxt.setTemplateMode(TemplateMode.TEXT);
templateResolverTxt.setCharacterEncoding("UTF-8");
templateResolverTxt.setCacheable(false);
mock.addTemplateResolver(templateResolverTxt);
return mock;
}
示例3: textTemplateResolver
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //導入方法依賴的package包/類
private ITemplateResolver textTemplateResolver() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(1);
templateResolver.setResolvablePatterns(Collections.singleton("text/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".txt");
templateResolver.setTemplateMode(TemplateMode.TEXT);
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
return templateResolver;
}
示例4: htmlTemplateResolver
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //導入方法依賴的package包/類
private ITemplateResolver htmlTemplateResolver() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(2);
templateResolver.setResolvablePatterns(Collections.singleton("html/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(TemplateMode.HTML);
templateResolver.setCharacterEncoding("UTF-8");
templateResolver.setCacheable(false);
return templateResolver;
}
示例5: stringTemplateResolver
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; //導入方法依賴的package包/類
private ITemplateResolver stringTemplateResolver() {
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(3);
templateResolver.setTemplateMode(TemplateMode.HTML5);
templateResolver.setCacheable(false);
return templateResolver;
}