Package org.apache.velocity.spring
Class VelocityEngineFactoryBean
- java.lang.Object
-
- org.apache.velocity.spring.VelocityEngineFactory
-
- org.apache.velocity.spring.VelocityEngineFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.FactoryBean<VelocityEngine>
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ResourceLoaderAware
public class VelocityEngineFactoryBean extends VelocityEngineFactory implements org.springframework.beans.factory.FactoryBean<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.- Since:
- 2020-05-29
- Author:
- Juergen Hoeller, Claude Brisson
- 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.apache.velocity.spring.VelocityEngineFactory
logger
-
-
Constructor Summary
Constructors Constructor Description VelocityEngineFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
VelocityEngine
getObject()
Class<? extends VelocityEngine>
getObjectType()
boolean
isSingleton()
-
Methods inherited from class org.apache.velocity.spring.VelocityEngineFactory
createVelocityEngine, getResourceLoader, initSpringResourceLoader, initVelocityResourceLoader, isPreferFileSystemAccess, newVelocityEngine, postProcessVelocityEngine, setConfigLocation, setPreferFileSystemAccess, setResourceLoader, setResourceLoaderPath, setVelocityProperties, setVelocityPropertiesMap
-
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws IOException, VelocityException
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
IOException
VelocityException
-
getObject
public VelocityEngine getObject()
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<VelocityEngine>
-
getObjectType
public Class<? extends VelocityEngine> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<VelocityEngine>
-
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<VelocityEngine>
-
-