org.thymeleaf.spring3
Class SpringTemplateEngine

Object
  extended by org.thymeleaf.TemplateEngine
      extended by org.thymeleaf.spring3.SpringTemplateEngine
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware

public class SpringTemplateEngine
extends org.thymeleaf.TemplateEngine
implements org.springframework.context.MessageSourceAware, org.springframework.beans.factory.InitializingBean

Subclass of TemplateEngine meant for Spring MVC applications, that establishes by default an instance of SpringStandardDialect as a dialect (instead of an instance of StandardDialect, which is the default in TemplateEngine.

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.

Note that this class will validate during initialization that at least one of the configured dialects is SpringStandardDialect or a subclass of it.

Since:
1.0
Author:
Daniel Fernández

Field Summary
 
Fields inherited from class org.thymeleaf.TemplateEngine
TIMER_LOGGER_NAME
 
Constructor Summary
SpringTemplateEngine()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void initializeSpecific()
           
protected  void initializeSpringSpecific()
           Called during initialization of this Template Engine.
 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.
 
Methods inherited from class org.thymeleaf.TemplateEngine
addDialect, addDialect, addMessageResolver, addTemplateModeHandler, addTemplateResolver, clearDialects, clearTemplateCache, clearTemplateCacheFor, getCacheManager, getConfiguration, getDialects, getDialectsByPrefix, getMessageResolvers, getTemplateModeHandlers, getTemplateRepository, getTemplateResolvers, initialize, isInitialized, process, process, process, process, process, process, setAdditionalDialects, setCacheManager, setDefaultMessageResolvers, setDefaultTemplateModeHandlers, setDialect, setDialects, setDialectsByPrefix, setMessageResolver, setMessageResolvers, setTemplateModeHandlers, setTemplateResolver, setTemplateResolvers, threadIndex
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringTemplateEngine

public SpringTemplateEngine()
Method Detail

setMessageSource

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).

Specified by:
setMessageSource in interface org.springframework.context.MessageSourceAware
Parameters:
messageSource - the message source to be used by the message resolver

setTemplateEngineMessageSource

public 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.

Parameters:
templateEngineMessageSource - the message source to be used by the message resolver
Since:
2.0.15

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

initializeSpecific

protected final void initializeSpecific()
Overrides:
initializeSpecific in class org.thymeleaf.TemplateEngine

initializeSpringSpecific

protected void initializeSpringSpecific()

Called during initialization of this Template Engine. Meant to be overridden by subclasses.



Copyright © 2013 The THYMELEAF team. All Rights Reserved.