How to Create Spring MVC application Using Spring Tool Suite

Creating a basic Spring MVC project was a difficult thing for beginners because it involves so many steps from configuring all spring dependencies to deploying into some server. But once Spring Tool Suite introduced, creating a Spring MVC application has become a very simple process. In this post we are going to see how to create Spring MVC application using Spring Tool Suite within a minute.

How to Create Spring MVC application Using Spring Tool Suite(SPS) within a minute
How to Create Spring MVC application Using Spring Tool Suite(SPS) within a minute

Before going to start first let me tell you what are all the Pre-requisite software or jars which is required to develop the Spring MVC.

  1. Spring Tool Suite IDE 3.7.2 (Based on Eclipse Mars.1 (4.5.1)) – Download here
  2. Spring 4.1.1 – Maven is sufficient, no download is required.
  3. JDK 1.8 – Download from here

See Also:

How to Create Spring MVC Application using Java Configuration

 

First Create a New Project.

Creating Spring MVC application Using Spring Tool Suite
Creating Spring MVC application Using Spring Tool Suite

 

Note:

In some of the STS IDE, we can able to select Spring Project directly. If your STS are not having an option then got with this approach. Select Spring Legacy Project from the menu.

Once you select and click on next we will see a window to select Spring MVC Project. At the top we are required to give project name and click next. I have given as STSSpringMVCHelloWorld.

Creating Spring MVC application Using Spring Tool Suite - Select Project
Creating Spring MVC application Using Spring Tool Suite – Select Project

Followed by that we will get a window to give high level package name.

 Creating Spring MVC application Using Spring Tool Suite(STS)- Give High Level Package

Creating Spring MVC application Using Spring Tool Suite – Give High Level Package

That’s it. We will get a project like this.

Creating Spring MVC application Using Spring Tool Suite - Project Structure
Creating Spring MVC application Using Spring Tool Suite – Project Structure

Note:

In some times we will get a project with errors. To avoid those errors, update the project using maven by following the below image. Right click the project, go to Maven and Update Project.

Creating Spring MVC application Using Spring Tool Suite - Update Project
Creating Spring MVC application Using Spring Tool Suite – Update Project
Creating Spring MVC application Using Spring Tool Suite - Update Project -Select Project
Creating Spring MVC application Using Spring Tool Suite – Update Project -Select Project

Once you click Update Project, we will get a window to select the project to Update. Also make sure Force Update of Snapshots/Releases checkbox is unchecked.

This STS bundled with Tomcat 7 and Tomcat 8, so by default we could see Server window in the STS Eclipse (See below Image). So we just have to add the project and start the server. That’s it.

Creating Spring MVC application Using Spring Tool Suite - Server
Creating Spring MVC application Using Spring Tool Suite – Server

How to add Project to the Server

Follow the below steps and add a Project to the Server which is bundled with STS.

Right click the Server and Click on Add and Remove.

Creating Spring MVC application Using Spring Tool Suite - Add Project to Server
Creating Spring MVC application Using Spring Tool Suite – Add Project to Server

We will see a window like this. Add our project and click on “Finish” and start the server. That’s it.

Creating Spring MVC application Using Spring Tool Suite - Add Project to Server - Select Project
Creating Spring MVC application Using Spring Tool Suite – Add Project to Server – Select Project

Open the browser and hit the URL as below.

http://localhost:8080/helloworld/

Creating Spring MVC application Using Spring Tool Suite - Excute Project
Creating Spring MVC application Using Spring Tool Suite – Excute Project

Note

I have added my message in HomeController.java and displayed it in home.jsp

We will see in detail about all the files in our next tutorials blogs. This How to Create Spring MVC application using Spring Tool Suite is available in my repository also, to download please click the link below.

 

Download link for How to Create Spring MVC application using Spring Tool Suite

Create-Spring-MVC-Application-Using-Spring-Tool-Suite
Create-Spring-MVC-Application-Using-Spring-Tool-Suite

 

11 Comments

  1. Paresh March 17, 2016 Reply
  2. Joel June 21, 2016 Reply
  3. Keivn July 21, 2016 Reply
  4. naveen April 25, 2017 Reply
  5. Pablo June 16, 2017 Reply
  6. Mahesh June 21, 2017 Reply
  7. harsha July 6, 2017 Reply
  8. Chirag Panchal August 26, 2017 Reply
    • adminAuthor August 28, 2017 Reply
  9. amal November 24, 2017 Reply

Add a Comment

Your email address will not be published. Required fields are marked *