Cyber Guard
Fight against cyber crime

How to create spring boot project in STS using maven

This post is about how to create spring boot project in STS using maven. This video shows create spring mvc project using maven in STS.

What is STS (Spring Tool Suite)

How to use STS
How to use STS with Maven

Spring tool Suite is an enhanced version of Eclipse. It is specially built to support spring based development. We need not to add plugins for spring and maven development as compared to Eclipse .

It is easy to use for any type of programmer. Spring tool Suite is available for linux, Mac and Windows. Recent version of Spring tool Suite is 4.

Spring tool Suite 4 does not need explicit maven plugin. It has inbuilt maven plugin installed. Spring and Spring tool Suite both are from spring.io. Hence, we do expect better support for Spring development in STS. We do not need spring boot initializr in STS to create Spring project.

Spring tool Suite has inbuilt Spring boot initializr.

To download STS use the Link from spring.io

You will find the following screen in browser

View the following video to find how to install and How to create spring boot project in STS using maven

  • To install STS in Mac download .dmg file
  • To install STS in Windows download .jar file.

For Windows 32 bit STS is available in following URL.

Download the Zip for STS 3.9.6 32 bit

After creating the project as described in video. Edit pom.xml to add the jasper dependency

<dependencies>
.......
.......
  <dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
  </dependency>
</dependencies>

Add the following lines in application.properties file

spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
How to built project in STS application.properties file
How to built project in STS application.properties file

Create a JSP named index.jsp with HTML code

The code must be created in WEB-INF\jsp location. The folder WEB-INF needs to be created inside src–main–webapp. the folder named jsp needs to be created inside WEB-INF folder. Refer to the above video for detailed description.

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1 align="center">Hello STS</h1>
</body>
</html>

Run the project to see the following output.

Right click on the .java file in the parent package (DemoApplication.java) which contains main() –Run As– Java Application

STS spring boot output from web browser
STS spring boot output from web browser

For creating the same project in Eclipse , visit the following URL.

Click here to see the tutorial on

Download the full source code of the project

Share

You may also like...

Leave a Reply

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