@Configuration public class ThymeleafConfiguration extends Object implements ResourceLoaderAware
ThymeleafViewResolver and auxiliary components needed by
Thymeleaf.| Constructor and Description |
|---|
ThymeleafConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureDialects(org.thymeleaf.spring4.SpringTemplateEngine templateEngine)
Configures the (non-standard) dialects that are supported by the template
engine.
|
protected String |
getTemplateCharacterEncoding()
Returns the character encoding used for template files.
|
protected org.thymeleaf.templatemode.TemplateMode |
getTemplateMode()
Returns the template mode used by Thymeleaf when processing templates.
|
protected String |
getTemplatePrefix()
Returns the prefix prepended to template names in order to find the
resource storing the template.
|
protected String |
getTemplateSuffix()
Returns the suffix appended to template names in order to find the
resource storing the template.
|
protected String |
getViewCharacterEncoding()
Returns the character encoding used for the output generated by the
template engine.
|
protected String |
getViewContentType()
Returns the content type associated with the output generated by the
template engine.
|
protected boolean |
isCacheTemplates()
Tells whether templates should be cached.
|
void |
setDevelopmentModeProperties(DevelopmentModeProperties developmentModeProperties)
Sets the development-mode properties used by this configuration.
|
void |
setResourceLoader(ResourceLoader resourceLoader) |
nz.net.ultraq.thymeleaf.LayoutDialect |
thymeleafLayoutDialect()
Creates the Thymeleaf layout dialect.
|
org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect |
thymeleafSpringSecurityDialect()
Creates the Thymeleaf Spring Security dialect.
|
org.thymeleaf.spring4.SpringTemplateEngine |
thymeleafTemplateEngine()
Creates the Thymeleaf template engine.
|
org.thymeleaf.templateresolver.ITemplateResolver |
thymeleafTemplateResolver()
Creates the template resolver used by Thymeleaf to resolve template
names.
|
UriExpanderDialect |
thymeleafUriExpanderDialect()
Creates the Thymeleaf URI expander dialect.
|
org.thymeleaf.spring4.view.ThymeleafViewResolver |
thymeleafViewResolver()
Creates the Thymeleaf view resolver.
|
@Autowired public void setDevelopmentModeProperties(DevelopmentModeProperties developmentModeProperties)
developmentModeProperties - development-mode properties to be used by this configuration.protected boolean isCacheTemplates()
DevelopmentModeProperties.isEnabled() returns false
).true if templates should be cached,
false if they should be checked for changes on every
request.protected String getTemplatePrefix()
classpath:/META-INF/templates/protected String getTemplateSuffix()
.html.protected org.thymeleaf.templatemode.TemplateMode getTemplateMode()
HTML5 to produce
HTML5 output.protected String getTemplateCharacterEncoding()
UTF-8.protected String getViewCharacterEncoding()
UTF-8.
When overriding this method, one should also override
getViewContentType().protected String getViewContentType()
getViewCharacterEncoding().protected void configureDialects(org.thymeleaf.spring4.SpringTemplateEngine templateEngine)
thymeleafTemplateEngine() after
creating the template engine. The default implementation adds the layout
dialect, the Spring Security dialect, and the URI expander dialect.templateEngine - template engine to which dialects can be added.@Bean public org.thymeleaf.templateresolver.ITemplateResolver thymeleafTemplateResolver()
getTemplatePrefix(), getTemplateSuffix(),
getTemplateMode(), getTemplateCharacterEncoding(), and
isCacheTemplates().@Bean public org.thymeleaf.spring4.SpringTemplateEngine thymeleafTemplateEngine()
thymeleafViewResolver(). The template engine is configured
to use the thymeleafTemplateResolver() and subsequently passed
on to configureDialects(SpringTemplateEngine).@Bean public nz.net.ultraq.thymeleaf.LayoutDialect thymeleafLayoutDialect()
configureDialects(SpringTemplateEngine).@Bean public org.thymeleaf.extras.springsecurity4.dialect.SpringSecurityDialect thymeleafSpringSecurityDialect()
configureDialects(SpringTemplateEngine).@Bean public UriExpanderDialect thymeleafUriExpanderDialect()
configureDialects(SpringTemplateEngine).@Bean public org.thymeleaf.spring4.view.ThymeleafViewResolver thymeleafViewResolver()
thymeleafTemplateEngine()
and use the character encoding and content type provided by
getViewCharacterEncoding() and getViewContentType().
This implementation used a modified version of
ThymeleafViewResolver that only handles a view name when the
corresponding template file exists. This makes it possible to use the
view resolver together with other view resolvers that come later in the
chain.public void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader in interface ResourceLoaderAwareCopyright © 2011–2017 aquenos GmbH. All rights reserved.