org.springframework.web.servlet.view.velocity
Class VelocityConfigurer

org.springframework.ui.velocity.VelocityEngineFactory
  |
  +--org.springframework.web.servlet.view.velocity.VelocityConfigurer

public class VelocityConfigurer
extends VelocityEngineFactory
implements ApplicationContextAware, VelocityConfig

JavaBean to configure Velocity for web usage, via the "configLocation" and/or "velocityProperties" and/or "resourceLoaderPath" bean properties. If neither of them is set, the default config location "/WEB-INF/velocity.properties" will be used.

This bean must be included in the application context of any application using Spring's VelocityView for web MVC. It exists purely to configure Velocity. It is not meant to be referenced by application components but just internally by VelocityView. Implements VelocityConfig to be found by VelocityView without depending on the bean name the configurer. Each DispatcherServlet can define its own VelocityConfigurer if desired.

The simplest way to use this class is to specify just a "resourceLoaderPath": the VelocityEngine does not need any more configuration then.

<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
  <property name="resourceLoaderPath"><value>/WEB-INF/velocity/</value></property>
</bean>

Author:
Rod Johnson, Juergen Hoeller
Version: $Id: VelocityConfigurer.java,v 1.10 2003/12/30 00:26:44 jhoeller Exp $
See Also: org.springframework.ui.velocity.VelocityEngineFactory.setConfigLocation(org.springframework.core.io.Resource), org.springframework.ui.velocity.VelocityEngineFactory.setVelocityProperties(java.util.Properties), org.springframework.ui.velocity.VelocityEngineFactory.setResourceLoaderPath(org.springframework.core.io.Resource), VelocityView

Field Summary
 final static StringDEFAULT_CONFIG_LOCATION
           

Method Summary
 voidsetApplicationContext(ApplicationContext applicationContext)
           

Methods inherited from class org.springframework.ui.velocity.VelocityEngineFactory
getVelocityEngine, initVelocityEngine, setConfigLocation, setOverrideLogging, setResourceLoaderPath, setVelocityProperties

Field Detail

DEFAULT_CONFIG_LOCATION

public final static String DEFAULT_CONFIG_LOCATION
Method Detail

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)

Association Links

to Class java.lang.String

to Class org.springframework.context.ApplicationContext