Spring MVC 3.1 Quickstart Maven Archetype

Spring 3.1 brings many enhancements to its MVC framework. Many times I need to start some basic project to consult new things on the project for the presentation, blog post or just for myself. In order to make the creation of each project repeatable and easy process I decided to create Maven archetype for that puropose. Currently it is a snapshot version that support basic Spring MVC 3.1 project with JPA2.0 and Apache Tiles. See more details on the spring-mvc-quickstart-archetype project page how to get started with it.

If you have any suggestions or you would like to join this project, please let me know.


  1. Isn't there something missing in this archetype. When I try to deploy the project the context is not loaded? Any tips?

  2. Replies
    1. I was trying to deploy it on jetty, but strangely it doesn't work. When I switched to tomcat it runs like a charm. Thanks

    2. I was curious about Jetty, so I downloaded Jetty 8.1 (eclipse) and tried to deploy the app. From logs, I see from logs it is deployed, but application is not accessible. I will have a look on that.

      What problems did you have with Jetty?

    3. I verified the build, and it works for me on Jetty 8.1!

      Accidentally, I ran 2 instances of Jetty ;)

      Steps I did:

      1) Download Jetty 8.1 from Eclipse
      2) Create the application from archetype, and then mvc clean package
      3) copy the war (under the new name: demo.war) to webapps of jetty
      4) create config file in contexts dir demo.xml with required configuration copied from test.xml
      4) Run jetty:

      D:\java\jetty-distribution-8.1.6.v20120903>%JAVA_HOME%/bin/java -jar start.jar OPTIONS=Server,All

      5) Navigate to localhost:8080/demo

      Tada! It works fine!

    4. Hey, I switched to tomcat but from your description I can say that you have two contexts in jetty. Anyways I use tomcat now and everything works jut fine. Unfortunately I am having really hard time switching to velocity from jsp. I am following this guide http://tiles.apache.org/framework/tutorial/integration/velocity.html but i can't get this to work

  3. also for me
    Exception starting filter securityFilter: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'securityFilter' is defined

    1. Hi,

      I just checked this archetype once again with Tomcat 7.0.27. It works perfectly fine for me.

      What I do with the project is:

      mvn clean package

      I copy the war into Apache webapps folder and I start Apache. Everything works for me. App is initializing, I can browse.

      In order to help you (both), I need more details of how are you doing the deployment, server version etc.

      Thanks in advance

    2. Well - i commented securityFilter stuff - and it was deployed (I work with JBoss and it works for any maven archetype with little plugin stuff correcture)

      mvn clean package;mvn jboss-as:deploy

      But now no url works thought log shows they were mapped

      14:52:14,304 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-3) Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.stuzo.platform.web.IndexController.index(org.springframework.ui.Model)
      14:52:14,305 INFO [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] (MSC service thread 1-3) Mapped "{[/user],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.stuzo.platform.web.UserController.index(org.springframework.security.core.userdetails.UserDetails,org.springframework.ui.Model)
      14:52:14,438 INFO [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping] (MSC service thread 1-3) Mapped URL path [/resources/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

    3. I work with JBoss - and it works 100% with any maven archetype project.
      Removed securityFilter stuff - and project deployed successfully - but shows 404 error.
      Probably I will try to modify standard maven SpringMVC project to this step by step to see where the problem

    4. Please report an issue on GH. Thanks.

    5. This is something with JBoss, tomcat is ok. Java world is not so perfect as I thought)))


Post a Comment

Popular posts from this blog

Different ways of validating @RequestBody in Spring MVC with @Valid annotation