public class SpringTemplateEngine extends org.thymeleaf.TemplateEngine implements ISpringTemplateEngine, org.springframework.context.MessageSourceAware
Implementation of ISpringTemplateEngine
, meant for Spring applications,
that establishes by default an instance of SpringStandardDialect
as a dialect (instead of an instance of StandardDialect
.
It also configures a SpringMessageResolver
as message resolver, and
implements the MessageSourceAware
interface in order to let Spring
automatically setting the MessageSource
used at the application
(bean needs to have id "messageSource"). If this Spring standard setting
needs to be overridden, the setTemplateEngineMessageSource(MessageSource)
can
be used.
Constructor and Description |
---|
SpringTemplateEngine() |
Modifier and Type | Method and Description |
---|---|
protected void |
initializeSpecific() |
protected void |
initializeSpringSpecific()
This method performs additional initializations required for a
SpringTemplateEngine subclass instance.
|
void |
setMessageSource(org.springframework.context.MessageSource messageSource)
Implementation of the
MessageSourceAware.setMessageSource(MessageSource)
method at the MessageSourceAware interface, provided so that
Spring is able to automatically set the currently configured MessageSource into
this template engine. |
void |
setTemplateEngineMessageSource(org.springframework.context.MessageSource templateEngineMessageSource)
Convenience method for setting the message source that will
be used by this template engine, overriding the one automatically set by
Spring at the
setMessageSource(MessageSource) method. |
addDialect, addDialect, addLinkBuilder, addMessageResolver, addTemplateResolver, clearDialects, clearTemplateCache, clearTemplateCacheFor, getCacheManager, getConfiguration, getDecoupledTemplateLogicResolver, getDialects, getDialectsByPrefix, getEngineContextFactory, getLinkBuilders, getMessageResolvers, getTemplateResolvers, isInitialized, process, process, process, process, process, process, processThrottled, processThrottled, processThrottled, setAdditionalDialects, setCacheManager, setDecoupledTemplateLogicResolver, setDialect, setDialects, setDialectsByPrefix, setEngineContextFactory, setLinkBuilder, setLinkBuilders, setMessageResolver, setMessageResolvers, setTemplateResolver, setTemplateResolvers, threadIndex
public void setMessageSource(org.springframework.context.MessageSource messageSource)
Implementation of the MessageSourceAware.setMessageSource(MessageSource)
method at the MessageSourceAware
interface, provided so that
Spring is able to automatically set the currently configured MessageSource
into
this template engine.
If several MessageSource
implementation beans exist, Spring will inject here
the one with id "messageSource".
This property should not be set manually in most scenarios (see
setTemplateEngineMessageSource(MessageSource)
instead).
setMessageSource
in interface org.springframework.context.MessageSourceAware
messageSource
- the message source to be used by the message resolverpublic void setTemplateEngineMessageSource(org.springframework.context.MessageSource templateEngineMessageSource)
Convenience method for setting the message source that will
be used by this template engine, overriding the one automatically set by
Spring at the setMessageSource(MessageSource)
method.
setTemplateEngineMessageSource
in interface ISpringTemplateEngine
templateEngineMessageSource
- the message source to be used by the message resolverprotected final void initializeSpecific()
initializeSpecific
in class org.thymeleaf.TemplateEngine
protected void initializeSpringSpecific()
This method performs additional initializations required for a
SpringTemplateEngine subclass instance. This method
is called before the first execution of
TemplateEngine.process(String, org.thymeleaf.context.IContext)
or TemplateEngine.processThrottled(String, org.thymeleaf.context.IContext)
in order to create all the structures required for a quick execution of
templates.
THIS METHOD IS INTERNAL AND SHOULD NEVER BE CALLED DIRECTLY.
The implementation of this method does nothing, and it is designed for being overridden by subclasses of SpringTemplateEngine.
Copyright © 2017 The THYMELEAF team. All rights reserved.