Creating a Spring web application

In this recipe, we will build a simple Spring web application with Eclipse. We will:

  • Create a new Maven project
  • Add Spring to it
  • Add two Java classes to configure Spring
  • Create a "Hello World" web page

In the next recipe, we will compile and run this web application.

How to do it…

In this section, we will create a Spring web application in Eclipse.

Creating a new Maven project in Eclipse

  1. In Eclipse, in the File menu, select New | Project….
  2. Under Maven, select Maven Project and click on Next >.
  3. Select the Create a simple project (skip archetype selection) checkbox and click on Next >.
  4. For the Group Id field, enter com.springcookbook. For the Artifact Id field, enter springwebapp. For Packaging, select war and click on Finish ...

Get Spring Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.