Getting Started with Spring Boot 2
4.1 (267 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,621 students enrolled

Getting Started with Spring Boot 2

Start building Spring Framework 5 & Spring Boot 2 applications today!
4.1 (267 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,622 students enrolled
Created by Dan Vega
Last updated 10/2019
English [Auto]
Current price: $139.99 Original price: $199.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 13 hours on-demand video
  • 3 articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • The new features in Spring Boot 2 and Spring Framework 5
  • Spring MVC
  • Spring Security & Thymeleaf
  • Spring Data JPA
  • Spring Boot Essentials
Course content
Expand all 104 lectures 12:56:22
+ Introduction
7 lectures 42:54

In this introduction we are going to discuss what you can expect from this course. I will give you a brief intro to who I am and why I am so passionate about what I do.

Preview 04:00

In this lesson we are going to discuss what our goals are for the course. We will define who this course is for and more importantly who this course isn't for.

Preview 07:24

In this lesson we are going to make sure that we all have our development environment setup correctly. All the links for the resources we discuss in this lesson will be in the documentation. You haven't seen the docs yet but we will discuss this in an upcoming lesson.

Development Environment Setup

Many students get confused about what the Spring Framework is used for vs why we need Spring Boot. In this lesson I will try and answer those questions.

Preview 13:32
Course Resources Update

I have spent a lot of time writing documentation for this course and I really hope it pays off. I will include a link to the github repository in the additional resources. Every single thing we are going to talk about is in the documentation.

Preview 04:52
Join my community
+ Project Overview
6 lectures 44:22

In this course we are going to build a clone of reddit. In this lesson we are going to talk about reddit and what we can expect to build in this course.

Preview 02:57

Now that we have created our application, it's time to explore what the Spring Initializr actually did for us.

Running with Spring Boot

In this lesson we are going to look at the requirements for this project.


In this lesson we will discuss the process for creating the templates used in this project.

Mockup the UI

In this lesson we will take a look at a quick domain model that I have created. This will at least give us a plan to start creating our domain model in our application.

Domain Model
+ Github
5 lectures 27:13

In this section we are going to look at where the repositories are for this course. We will also create the initial repository for this project and talk about our branching strategy.


In this lesson we are going to create the initial repository and pushing it to Github.

Create the initial Repository

In this lesson we are going to talk about creating a README file for your Github project.


In this lesson we are going to discuss our branching strategy for this course. Each time that we begin to create a new feature we will create a new branch.

Git Workflow

In the documentation I added some useful links to learn all about using Git & Github.

Using Git & Github
+ Spring Boot Essentials
6 lectures 49:06

In this lesson we are going to discuss what we need to cover in this section.

  • Spring Boot DevTools

  • Configuration & Properties

  • Profiles

  • Debugging & Logging

  • Actuator

Spring Boot Essentials Introduction

In this lesson we are going to talk about one of my favorite essentials, Spring Boot Developer Tools. The Developer Tools help make us a more productive developer and you really should be using them in your development environment.

Spring Boot Devtools
Configuration & Properties

Profiles give us a nice clean approach to separate our configuration for different environments.


In this lesson we are going to discuss debugging & logging. I think these are 2 important skills that help me become a better developer.

Debugging & Logging

In this lesson I am going to introduce you to the Spring Boot Actuator. We are also going to discuss what has changed from Spring Boot 1.x

+ Spring MVC: Model
7 lectures 01:18:28

In this lesson we are going to introduce Spring Data JPA. What is JPA, Hibernate and how does this all fit into our application? 

Preview 11:53

In this lesson we are going to start building our model by creating some entities.


In this lesson we are going to refactor our entities using Project Lombok.

Project Lombok Refactor

The central interface in the Spring Data repository abstraction is Repository. In this lesson we are going to create a repository for Link and Comment.


In this lesson we are going to discuss the relationships (Mappings) between our entities.

Entity Relationships (Mappings)

Spring Data provides sophisticated support to transparently keep track of who created or changed an entity and when the change happened. To benefit from that functionality, you have to equip your entity classes with auditing metadata that can be defined either using annotations or by implementing an interface.

Auditing Aware

We are going to merge our model branch back into master.

Merge Branch Back into Master
+ Database Layer
6 lectures 01:03:55

In the last section we took a look at how we build out our entities and repositories. We also learned that our entities map directly to a database table. The question that remains is where is this database located? Is it being created for us or is this up to us? We are going to answer these questions and more in this section.

  • Database Configuration

    • Common Database Properties

    • H2 vs MySQL

    • SQL Logging

    • Hibernate logging level DEBUG

  • Database Initialization

    • Hibernate DDL

    • schema.sql

    • data.sql

  • CommandLineRunner


If you can’t always remember what properties can be set in your there is a really good reference at the link below.

  • DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)

  • JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)

  • H2 Web Console

Preview 12:48

In the previous lesson we looked at how to use the H2 in-memory database. That is great for getting started but at some point we will want to move to a production ready database like MySQL. If you are using some other DBMS just do a quick search for what your settings will look like.

MySQL Settings

A database can be initialized in different ways depending on what your stack is. Of course, you can also do it manually, provided the database is a separate process. In this lesson we are going to look at how we can initialize the database schema and data.

Database Schema & Data

In this lesson we are going to look at a way to initialize our database using Java and the Command Line Runner interface.

Command Line Runner

In this lesson we are going to talk about how we can explore our repositories. We are also going to close out this section and merge the branch back into master.

Explore our Repositories
+ Spring MVC: Controller
5 lectures 41:13

We are now into the C in our MVC application. The C stands for controller and you can think of the controller as the traffic cop in our application. The controller handles incoming http requests and "directs traffic". Methods in your controller are mapped to HTTP by using @RequestingMapping (or one of its composed) annotations.

Spring MVC - What is a Controller

In this lesson we are going to discuss the differences between Controller and Rest Controller. We will also take some time to discuss what the @RequestMapping annotation is and what it can do for us.

Controller vs Rest Controller

@RequestMapping handler methods have a flexible signature and can choose from a range of supported controller method arguments and return values. I have included a link to the documentation that covers all of the available handler method arguments.

Controller Handler Methods

Now that we know a little bit more about controllers and what methods are available to us we should be able to start building out the basic parts of our Link Controller. 

Link Controller

It is time to close out this section and clean up our branch. Finally we are going to merge our spring-mvc-controller branch into master.

Merge Branch Back into Master
+ Spring MVC: The View Layer
9 lectures 01:25:30

If we were creating a REST service application we wouldn’t need any view. Instead we are creating a Spring MVC app with a front end using a template engine. As we will see in a bit, we have many choices when it comes to what template engines we can use.

Spring MVC: View (The User Interface)

Now that we know how to serve static content we need to understand how to serve dynamic content. This is where templates come into play and lucky for us Spring MVC supports a variety of template engines.

Preview 07:52

In this lesson we are going to discuss what is needed to get started with Thymeleaf.

Hello, Thymeleaf!

I mentioned these towards the beginning of the course and it’s finally time to use them. If you missed it earlier I created these so we wouldn’t have to waste time designing some basic templates. The point of this course is to teach you all about Spring Boot, not design. If you haven’t already downloaded them please do so now.

Moving our Spring-it Templates

In our templates, we will often want to include parts from other templates, parts like footers, headers, menus…

In order to do this, Thymeleaf needs us to define these parts, “fragments”, for inclusion, which can be done using the th:fragment attribute.

Thymeleaf Layouts

Now that we have our layout it’s time to build our first page, our list of links. Before we get started it would be a good idea to have a list of links in our database. I went over to one of my favorite subreddits /r/springboot and just grabbed 11 items for testing.

List Links (Home)

In this lesson we are going to build a link view page.

View Link

In this lesson we are going to build our submit link page.

Submit Link

In this lesson we are going to wrap up this section on Spring MVC: View. We are also going to merge this branch back into master.

Conclusion & Merge
+ Spring Security: Configuration
8 lectures 01:10:05

In this lesson we are going to discuss a very important topic and that is security. It turns out that Security is really hard and it isn’t something that we want to build ourselves. Luckily for us the Spring Security project is the standard for securing Spring based applications and it is really good at it.

Spring Security Introduction

In this lesson we are going to learn how to configure Spring Security. This is the start of our configuration but this is going to be something we build on throughout the course.


In the last lesson we used the default user & auto generated password to test our configuration. While It was good for a quick test we really need to implement something a little bit better. In this lesson we are going to create our User & Role entities and hook them into Spring Security.

Users & Roles

The User Details Service is a core interface in Spring Security. In this lesson we are going to look at how we can configure our user details service.

User Details Service

Now that we have everything in place we can add some data for us to use in our development environment. In this lesson we will add some users & roles test data.

Add Users & Roles to Database

Now that we have security in place and we have some users and roles it’s time we revisit something we did a little bit earlier. Remember when we created the Auditable domain class that all of our other domain classes extended? Well we have the created & last updated dates working but now its time we tackle the user fields.

Auditing Configuration

Now that Spring Boot has backed off of Security we have a little bit of an issue with our actuator endpoints. Right now they are all wide open, so any user can get to them. In some cases this might be ok but in most it’s probably not. Let’s think about some rules that we want to incorporate for our actuator endpoints.

Actuator Security

If we try and go to our H2 Console (/h2-console) we won’t be able to get there. We need to do a couple of things to make this work. 

H2 Console Security
+ Spring Security: The View Layer
9 lectures 41:23

What we looked at in the last section was how to configure Spring Security. Now that we have a head start on security it’s time we integrate into our view layer. Here is what we are going to cover in this section:

  • Custom Login Form

  • Form Login and Logout

  • Remember Me Feature

  • Thymeleaf Spring Security Dialect

  • Account & Registration Templates


In this lesson we are going to create our own custom login form.

Custom Login Form

When we submit a form Spring Security is expecting 2 things from us:

  • The username must be present as the HTTP parameter named username

  • The password must be present as the HTTP parameter named password

Since our field is named "email" we just need to add one more configuration to our form login and that is usernameParameter("email")

Username & Password Form Parameters

When using the WebSecurityConfigurerAdapter, logout capabilities are automatically applied. The default is that accessing the URL /logout will log the user out by:

  • Invalidating the HTTP Session

  • Cleaning up any RememberMe authentication that was configured

  • Clearing the SecurityContextHolder

  • Redirect to /login?logout

  • Similar to configuring login capabilities, however, you also have various options to further customize your logout requirements:


Remember-me or persistent-login authentication refers to web sites being able to remember the identity of a principal between sessions. 

Remember Me

In Spring MVC environments, the Spring Security integration module works as a replacement of the Spring security taglib.

We use this dialect in the example in order to print the logged user credentials and to show different content to different roles.

Thymeleaf Spring Security Dialect

One thing that I noticed is that we never updated the display to show who actually submitted the link. In this lesson we will fix this issue up on the home page and the view link page.

Who Submitted this Link?

In this lesson we are going to update the templates for Register and Profile so that they display correctly. We aren't going to actually make these work right now but we do want to see them load.

Account & Register Templates

In this lesson we are going to wrap up the Spring Security View layer and merging the security section back into master.

Merge Branch Back into Master
  • Experience with the Java Programming Language
  • Experience Building Web Applications

This course offers hands-on experience building Spring Framework applications using Spring Boot. The first thing that is going to stand out is that we are going to move away from the boring, non-useful demos. In the new course, we are going to build a practical application from start to finish.

While we are creating this application together we will take a look at some of the new features Spring Framework 5 & Spring Boot 2 have to offer. By taking this course you will have the latest skills that you need to build real applications using the Spring Framework.

What is Spring Boot?

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".

Spring Boot takes an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

Build anything with Spring Boot

Spring Boot is the starting point for building all Spring-based applications. Spring Boot is designed to get you up and running as quickly as possible, with minimal upfront configuration of Spring.

  • Get started in seconds using Spring Initializr

  • Build anything - REST API, WebSocket, Web, Streaming, Tasks, and more

  • Simplified Security

  • Rich support for SQL and NoSQL

  • Embedded runtime support - Tomcat, Jetty, and Undertow

  • Developer productivity tools such as live reload and auto restart

  • Curated dependencies that just work

  • Production-ready features such as tracing, metrics and health status

  • Works in your favorite IDE - Spring Tool Suite, IntelliJ IDEA and NetBeans

Who this course is for:
  • Java Developer - You should be familiar with the Java Programming language. You don't need to be a rockstar (I certainly am not) but you should have an intermediate understanding.
  • Web Developer - While you don't need to know Spring to get started you should have some experience building web applications. If you have experience using another MVC framework that's even better but it's not required.
  • Heard of Spring - You don't need prior experience with Spring but if you have at least heard of it and understand what it is that will help you out.
  • New Features - You are interested in seeing some of the new features in Spring Framework 5 and Spring Boot 2.