Spring-Velocity
Spring-Velocity aims to provide a slightly different way of utilising Apache Velocity with the Spring framework. Whilst the existing integration provided with Spring is adequate, I felt it could be improved. Specifically, I felt the following modifications would be an improvement, so I implemented them:
- Support the changes to Velocity & Velocity Tools (esp. tools) since 1.5 and 2.0 (new toolbox format, no deprecation messages etc)
- Provide a standard, Spring-style means to utilise Spring context support to augment velocity tools infrastructure (
@ViewHelperannotation as a component stereotype which can have a Spring@Scopespecified automatically added to Velocity context) - Most importantly: work nicely with
ContentNegotiatingViewResolverso that a single velocity-based SpringViewcan be used to generate multiple text-based formats simply by dropping in additional templates (+ specifying in ContentNegotiatingViewResolver’s mediaTypes map) - Get all of the above to work transparently, out-of-the-box via annotations, and correctly determine what sort of “context” the app is running in (e.g. web app [access to servlet context] or plain token replacer with/without toolbox)
The source code and binaries can be downloaded from my maven repository.