Build a project with Spring Initializr or Spring Tool Suite™

This guide walks you through using Spring Initializr or Spring Tool Suite™ for building a simple Java project compatible with Maven and Spring.

Spring is an open source framework that has become very popular among the members of the Java community, because it can be an alternative to, replacement for, or even addition to the Enterprise JavaBeans (EJB) model. According to Pivotal, Spring framework helps development teams everywhere build simple, portable, fast and flexible JVM-based systems and applications.

What you’ll need

  • About 15 minutes
  • A favorite IDE
  • Spring Tool Suite™ already install
  • JDK 6 or later

Spring Initialzr

Starting a project using Spring is quite easy, as Pivotal has kindly created a Web Site for helping us bootstrap our new application. This Site is called Spring Initializr.

Once the page has finished loading, click on the link “Switch to the full version”. This will display additional fields. Something similar to what is shown in the image below.

We will be generating a “Maven Project” using Spring Boot “1.5.2”. Let’s start filling in our new project’s basic information:

  • Group: com.canchitodev.example
  • Artifact: demoproject
  • Name: demoproject
  • Description: Canchito-Dev demo project for Spring Boot
  • Package: com.canchitodev.example
  • Packaging: Jar
  • Java Version: 1.8
  • Language: Java

For the moment, we will not be adding any dependencies. So let’s just click on the <Generate Project> button, and it will automatically generate a zip file with your newly created project.

But what is project good for, if it is just a zip and does nothing? So, go to the folder where the zip was downloaded, and unzip it. Once it has finished, you can import it into your favorite IDE. In my case, I will be using Eclipse IDE for Java Developer version Mars.2 Release 4.5.2 (which can be downloaded from here). To import it, follow these steps:

  1. In Eclipse, go to “File” > “Import”.
  2. Select “Maven” > “Existing Maven Project” as the type of project to import and click .
  3. Browse to the folder were the project is located and click .

Among the imported files, you will see one called pom.xml. This is the file where Maven projects are defined. Among other things, this file gives the project’s name, version, and dependencies that it has on external libraries.

Spring Tool Suite™

There is no better description of what Spring Tool Suite™ is, than the one found in its official site: “The Spring Tool Suite™ is an Eclipse-based development environment that is customized for developing Spring applications. It provides a ready-to-use environment to implement, debug, run, and deploy your Spring applications, including integrations for Pivotal tc Server, Pivotal Cloud Foundry, Git, Maven, AspectJ, and comes on top of the latest Eclipse releases”. You can learn more by visiting the official site.

Follow these steps for creating a new project in Spring Tool Suite™:

  1. In the main menu, click on “File” > “New”. The “New Project” window will appear.
  2. Expand the “Spring” folder and select “Spring Starter Project”.
  3. Let’s start filling in our new project’s basic information:
    • Name: demoproject-sts
    • Browse to the folder were the project is located and click .
    • Group: com.canchitodev.example
    • Artifact: demoproject
    • Description: Canchito-Dev demo project for Spring Boot
    • Package: com.canchitodev.example
    • Packaging: Jar
    • Java Version: 1.8
    • Language: Java
    • Version: 0.0.1-SNAPSHOT
  4. Click on the <Next> button. The “New Spring Starter Project Dependencies” window is displayed.
  5. Just as in the previous section, we will at the moment nos add or incluyed dependencies on our project. So, just continue by clicking on the <Finish> button.

Summary

Congratulation! You have created your first project using Spring Initializr and Spring Tool Suite™. In the upcoming posts, we will be creating projects and manually including dependencies by modifying the pom.xml file. So stay tune.

About canchitodev

Professional with solid experience in software development and management, leadership, team-building, workflow design and technological development. I consider myself a proactive, creative problem-solver, results-driven and with exceptional interpersonal skills person, who likes challenges, working as part of a team, and in high demanding environments. In these last few years, my career has focused on software management, development and design in the Media Broadcasting for television stations, thus allowing the automation of workflows

0 0 votes
Article Rating
Subscribe
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments