spring-context-support

org.springframework.ui.velocity
Class VelocityEngineFactoryBean

java.lang.Object
  extended by org.springframework.ui.velocity.VelocityEngineFactory
      extended by org.springframework.ui.velocity.VelocityEngineFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.FactoryBean<org.apache.velocity.app.VelocityEngine>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware

public class VelocityEngineFactoryBean
extends VelocityEngineFactory
implements org.springframework.beans.factory.FactoryBean<org.apache.velocity.app.VelocityEngine>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware

Factory bean that configures a VelocityEngine and provides it as bean reference. This bean is intended for any kind of usage of Velocity in application code, e.g. for generating email content. For web views, VelocityConfigurer is used to set up a VelocityEngine for views.

The simplest way to use this class is to specify a "resourceLoaderPath"; you do not need any further configuration then. For example, in a web application context:

 <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
   <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
 </bean>
See the base class VelocityEngineFactory for configuration details.

Author:
Juergen Hoeller
See Also:
VelocityEngineFactory.setConfigLocation(org.springframework.core.io.Resource), VelocityEngineFactory.setVelocityProperties(java.util.Properties), VelocityEngineFactory.setResourceLoaderPath(java.lang.String), org.springframework.web.servlet.view.velocity.VelocityConfigurer

Field Summary
 
Fields inherited from class org.springframework.ui.velocity.VelocityEngineFactory
logger
 
Constructor Summary
VelocityEngineFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 org.apache.velocity.app.VelocityEngine getObject()
           
 java.lang.Class<? extends org.apache.velocity.app.VelocityEngine> getObjectType()
           
 boolean isSingleton()
           
 
Methods inherited from class org.springframework.ui.velocity.VelocityEngineFactory
createVelocityEngine, getResourceLoader, initSpringResourceLoader, initVelocityResourceLoader, isPreferFileSystemAccess, newVelocityEngine, postProcessVelocityEngine, setConfigLocation, setOverrideLogging, setPreferFileSystemAccess, setResourceLoader, setResourceLoaderPath, setVelocityProperties, setVelocityPropertiesMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.context.ResourceLoaderAware
setResourceLoader
 

Constructor Detail

VelocityEngineFactoryBean

public VelocityEngineFactoryBean()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.io.IOException,
                               org.apache.velocity.exception.VelocityException
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.io.IOException
org.apache.velocity.exception.VelocityException

getObject

public org.apache.velocity.app.VelocityEngine getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<org.apache.velocity.app.VelocityEngine>

getObjectType

public java.lang.Class<? extends org.apache.velocity.app.VelocityEngine> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<org.apache.velocity.app.VelocityEngine>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<org.apache.velocity.app.VelocityEngine>

spring-context-support