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
- Clone the repository to start a new project:
hg clone https://bitbucket.org/jsumners/spring-webmvc-skeleton YourNewProject.
- Edit the
pom.xmland change the "groupId", "artifactId", and "version" properties as desired.
<project_root>/src/main/resources/project.propertiesto 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/main/java/com/example/MyWebApplication/servlet/config/ContextConfiguration.javato 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.
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
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).