The Simple Web Application Module

The web application is defined in a simple-webapp project. This simple web application project is going to define two Spring MVC Controllers: WeatherController and HistoryController. Both of these controllers are going to reference components defined in simple-weather and simple-persist. The Spring container is configured in this application’s web.xml, which references the applicationContext-weather.xml file in simple-weather and the applicationContext-persist.xml file in simple-persist. The component architecture of this simple web application is shown in Figure 7-3.

Spring MVC controllers referencing components in simple-weather and simple-persist

Figure 7-3. Spring MVC controllers referencing components in simple-weather and simple-persist

The POM for simple-webapp is shown in Example 7-12.

Example 7-12. POM for simple-webapp

<project xmlns="http://maven.apache.org/POM/4.0.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                      http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.sonatype.mavenbook.ch07</groupId>
    <artifactId>simple-parent</artifactId>
    <version>1.0</version>
  </parent>

  <artifactId>simple-webapp</artifactId>
  <packaging>war</packaging>
  <name>Simple Web Application</name>
  <dependencies>
    <dependency> 1 <groupId>org.apache.geronimo.specs</groupId> ...

Get Maven: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.