Donny's Programming Blog

Making an SSR Web App with Spring Boot

March 01, 2019

The project from this article can be found here

Introduction

In this series, we’re going to be walking through making a web application using Spring Boot. The application we will be developing will be a web-based inventory application for a fictional publishing house called Literate Octo Dollop. The author will be using Eclipse as an IDE but you are free to use whichever IDE you are most comfortable with. If you already have a project setup and imported, you can skip to part 2.

Prerequisites

  • A Java IDE (I’ll be using Eclipse)
  • A working knowledge of Spring Boot
  • Git-Bash (Windows environments only) or Terminal
  • Gradle >= v5

Getting Started

The first thing we need to do is get a Spring project to work on. Let’s head over to the Spring Initializr. Here we’ll need to make some changes and add some dependencies.

  1. Make sure that project type is set to Gradle and language is set to Java
  2. Enter your Group Id: com.donhamiltoniii
  3. Enter your Artifact Name: literate-octo-dollop
  4. Add the dependencies we’ll be using (Web, DevTools, Thymeleaf, JPA, H2)
  5. Click Generate Project

Once your project downloads, extract it from the zip file and navigate to it from your command line. Once in the root of your project, let’s build out our project and import it into our IDE.

From the root directory of your project:

  1. Open build.gradle in a text editor of your choice and add id 'eclipse' to the plugins block and save.
  2. From your command line, run gradle eclipse
  3. Pending a successful build, import into your IDE of choice

Test Project

Now that our project is imported, we need to make sure everything is up and running correctly. Open the Application file and run it from your IDE. As long as your server starts without error, we’re all good and ready to get started.

Time to move on to Part 2


Don Hamilton III

Written by Don Hamilton III who lives and works in Columbus, OH teaching folx to program at We Can Code IT. You should follow him on Twitter