This is a simple skeleton project for a Spring WebMVC web application. It uses Maven to build the project. The configuration for the application uses as litle XML as possible. The primary configuration is done through standard Java.

The project is configured to allow definition of properties files that will be parsed during build but not added to the final WAR package.

Additionally, there are two profiles configured by default: "debug" and "production". You can build the project by doing either

mvn package -P debug


mvn package -P production

Important: the JavaDocs are going to be your best friend. The PDF (starting on page 437) will be of limited use.

Getting Started

  1. Clone the repository to start a new project: hg clone https://bitbucket.org/jsumners/spring-webmvc-skeleton YourNewProject.
  2. Edit the pom.xml and change the "groupId", "artifactId", and "version" properties as desired.
  3. Rename <project_root>/src/main/resources/project.properties to match your artifactId. E.G. if you changed artifactId to "SuperCoolProject" then the properties file should be "SuperCoolProject.properties". A. If you plan on using unit/whatever tests then you should do the same for <project_root>/src/test/resources/project.properties
  4. Edit <project_root>/src/main/java/com/example/MyWebApplication/servlet/config/ContextConfiguration.java to suit your needs. A. Truly, you should be refactoring the "com/example/MyWebApplication" to your actual project package(s). But you should copy the "servlet/config/*.java" files to your package as a starting point for your configuation.

Default Package

The default project builds one controller that maps to http://example.com/helloWorld (where example.com is localhost or anything else). This controller is in the com.example.MyWebApplication package.

Default Views Location

The default project maps views to /WEB-INF/jsp/ with a suffix of .jsp. You should adjust "ContextConfiguration.java" to suit your needs. Specifically, you need to adjust the viewResolver bean (or add more view resolver beans to the configuration).