JavaBean to configure Velocity for web usage, via the "configLocation"
and/or "velocityProperties" and/or "resourceLoaderPath" bean properties.
The simplest way to use this class is to specify just a "resourceLoaderPath";
you do not need any further configuration then.

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 (just
internally by VelocityView). This class implements VelocityConfig
in order to be found by VelocityView without depending on the bean name of
this configurer. Each DispatcherServlet may define its own VelocityConfigurer
if desired, potentially with different template loader paths.

Note that you can also refer to a pre-configured VelocityEngine
instance via the "velocityEngine" property, e.g. set up by
VelocityEngineFactoryBean,
This allows to share a VelocityEngine for web and email usage, for example.

This configurer registers the "spring.vm" Velocimacro library for web views
(contained in this package and thus in spring.jar), which makes
all of Spring's default Velocity macros available to the views.
This allows for using the Spring-provided macros such as follows:

Constructor Detail

VelocityConfigurer

Method Detail

setVelocityEngine

Set a pre-configured VelocityEngine to use for the Velocity web
configuration: e.g. a shared one for web and email usage, set up via
VelocityEngineFactoryBean.

Note that the Spring macros will not be enabled automatically in
case of an external VelocityEngine passed in here. Make sure to include
spring.vm in your template loader path in such a scenario
(if there is an actual need to use those macros).

If this is not set, VelocityEngineFactory's properties
(inherited by this class) have to be specified.

setServletContext

Invoked after population of normal bean properties but before an init
callback like InitializingBean's afterPropertiesSet or a
custom init-method. Invoked after ApplicationContextAware's
setApplicationContext.