本文整理匯總了Java中org.thymeleaf.spring4.view.ThymeleafViewResolver.setViewNames方法的典型用法代碼示例。如果您正苦於以下問題:Java ThymeleafViewResolver.setViewNames方法的具體用法?Java ThymeleafViewResolver.setViewNames怎麽用?Java ThymeleafViewResolver.setViewNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.thymeleaf.spring4.view.ThymeleafViewResolver
的用法示例。
在下文中一共展示了ThymeleafViewResolver.setViewNames方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: thymeleafViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
@ConditionalOnProperty(name = "spring.thymeleaf.enabled", matchIfMissing = true)
public ThymeleafViewResolver thymeleafViewResolver() {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
configureTemplateEngine(resolver, this.templateEngine);
resolver.setCharacterEncoding(this.properties.getEncoding().name());
resolver.setContentType(appendCharset(this.properties.getContentType(),
resolver.getCharacterEncoding()));
resolver.setExcludedViewNames(this.properties.getExcludedViewNames());
resolver.setViewNames(this.properties.getViewNames());
// This resolver acts as a fallback resolver (e.g. like a
// InternalResourceViewResolver) so it needs to have low precedence
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
resolver.setCache(this.properties.isCache());
return resolver;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:18,代碼來源:AbstractThymeleafViewResolverConfiguration.java
示例2: thymeleafViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
@ConditionalOnProperty(name = "spring.thymeleaf.enabled", matchIfMissing = true)
public ThymeleafViewResolver thymeleafViewResolver() {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(this.templateEngine);
resolver.setCharacterEncoding(this.properties.getEncoding().name());
resolver.setContentType(appendCharset(this.properties.getContentType(),
resolver.getCharacterEncoding()));
resolver.setExcludedViewNames(this.properties.getExcludedViewNames());
resolver.setViewNames(this.properties.getViewNames());
// This resolver acts as a fallback resolver (e.g. like a
// InternalResourceViewResolver) so it needs to have low precedence
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
resolver.setCache(this.properties.isCache());
return resolver;
}
示例3: thymeleafViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
@ConditionalOnProperty(name = "spring.thymeleaf.enabled", matchIfMissing = true)
public ThymeleafViewResolver thymeleafViewResolver() {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(this.templateEngine);
resolver.setCharacterEncoding(this.properties.getEncoding().name());
resolver.setContentType(appendCharset(this.properties.getContentType(),
resolver.getCharacterEncoding()));
resolver.setExcludedViewNames(this.properties.getExcludedViewNames());
resolver.setViewNames(this.properties.getViewNames());
// This resolver acts as a fallback resolver (e.g. like a
// InternalResourceViewResolver) so it needs to have low precedence
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
return resolver;
}
示例4: xmlViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的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;
}
示例5: thymeleafViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
@ConditionalOnProperty(name = "spring.thymeleaf.enabled", matchIfMissing = true)
public ThymeleafViewResolver thymeleafViewResolver() {
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(this.templateEngine);
resolver.setCharacterEncoding(this.properties.getEncoding());
resolver.setContentType(appendCharset(this.properties.getContentType(), resolver.getCharacterEncoding()));
resolver.setExcludedViewNames(this.properties.getExcludedViewNames());
resolver.setViewNames(this.properties.getViewNames());
setStaticVariables(resolver);
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
return resolver;
}
示例6: thymeleafViewResolver
import org.thymeleaf.spring4.view.ThymeleafViewResolver; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
public ThymeleafViewResolver thymeleafViewResolver() {
final ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(this.templateEngine);
resolver.setCharacterEncoding(this.environment.getProperty("encoding", "UTF-8"));
resolver.setContentType(appendCharset(this.environment.getProperty("contentType", "text/html"), resolver.getCharacterEncoding()));
resolver.setExcludedViewNames(this.environment.getProperty("excludedViewNames", String[].class));
resolver.setViewNames(this.environment.getProperty("viewNames", String[].class));
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
resolver.setCache(this.environment.getProperty("cache", Boolean.class, true));
return resolver;
}