Spring-Velocity

Spring-Velocity aims to pro­vide a slightly dif­fer­ent way of util­is­ing Apache Veloc­ity with the Spring frame­work. Whilst the exist­ing inte­gra­tion pro­vided with Spring is ade­quate, I felt it could be improved. Specif­i­cally, I felt the fol­low­ing mod­i­fi­ca­tions would be an improve­ment, so I imple­mented them:

  1. Sup­port the changes to Veloc­ity & Veloc­ity Tools (esp. tools) since 1.5 and 2.0 (new tool­box for­mat, no dep­re­ca­tion mes­sages etc)
  2. Pro­vide a stan­dard, Spring-style means to utilise Spring con­text sup­port to aug­ment veloc­ity tools infra­struc­ture (@ViewHelper anno­ta­tion as a com­po­nent stereo­type which can have a Spring @Scope spec­i­fied auto­mat­i­cally added to Veloc­ity context)
  3. Most impor­tantly: work nicely with ContentNegotiatingViewResolver so that a sin­gle velocity-based Spring View can be used to gen­er­ate mul­ti­ple text-based for­mats sim­ply by drop­ping in addi­tional tem­plates (+ spec­i­fy­ing in ContentNegotiatingViewResolver’s medi­aTypes map)
  4. Get all of the above to work trans­par­ently, out-of-the-box via anno­ta­tions, and cor­rectly deter­mine what sort of “con­text” the app is run­ning in (e.g. web app [access to servlet con­text] or plain token replacer with/without toolbox)

The source code and bina­ries can be down­loaded from my maven repos­i­tory.