I’ve started using Spring MVC as my main web development framework. I’ve found it straightforward to learn and pleasant to use. However, I was a little disappointed that no standard Maven Archetype exists to quickly set up a new Spring MVC project from scratch.
A while back when I was learning Tapestry 5, I was astonished at how easy it is to create and run a demo Tapestry 5 project using the Tapestry Quickstart Maven archetype. One of the first things I looked for when learning Spring MVC was a similar Maven archetype. Unfortunately SpringSource have not provided one. Fortunately, Spring and Spring MVC have a very active user community and various developers have made their own archetypes available.
A great Spring MVC quickstart archetype is available on GitHub, courtesy of kolorobot. Good instructions are provided on how to install it to your local Maven repo and use it to create a new Spring MVC project. He’s even helpfully included the Tomcat 7 Maven plugin in the archetypical project so that the newly created Spring MVC can be run from the command line without having to manually deploy it to an application server.
In less than five minutes and just three Maven commands, I was able to create, compile and run a fully working example Spring MVC application. As I’m new to Spring MVC, it was great to start from a simple working application.
Kolorobot’s example application includes the following:
Java based container configuration
Spring’s new configuration mechanism – an alternative to the old XML based configuration.
Annotation based controllers
Controllers defined using annotations rather than by implementing interfaces or overriding base classes.