Class VelocityEngineFactoryBean

java.lang.Object
net.shibboleth.shared.spring.velocity.VelocityEngineFactory
net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean
All Implemented Interfaces:
Aware, FactoryBean<org.apache.velocity.app.VelocityEngine>, InitializingBean, ResourceLoaderAware

public class VelocityEngineFactoryBean extends VelocityEngineFactory implements FactoryBean<org.apache.velocity.app.VelocityEngine>, InitializingBean, 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="net.shibboleth.shared.spring.velocity.VelocityEngineFactoryBean">
   <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
 </bean>
See the base class VelocityEngineFactory for configuration details.
Since:
6.0.0
See Also:
  • Field Details

    • velocityEngine

      @Nullable private org.apache.velocity.app.VelocityEngine velocityEngine
      Engine being created.
  • Constructor Details

    • VelocityEngineFactoryBean

      public VelocityEngineFactoryBean()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws IOException, org.apache.velocity.exception.VelocityException
      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      IOException
      org.apache.velocity.exception.VelocityException
    • getObject

      @Nullable public org.apache.velocity.app.VelocityEngine getObject()
      Specified by:
      getObject in interface FactoryBean<org.apache.velocity.app.VelocityEngine>
    • getObjectType

      @Nullable public Class<? extends org.apache.velocity.app.VelocityEngine> getObjectType()
      Specified by:
      getObjectType in interface FactoryBean<org.apache.velocity.app.VelocityEngine>
    • isSingleton

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