Getting Started with Spring Boot 2
- 13 hours on-demand video
- 3 articles
- Full lifetime access
- Access on mobile and TV
- Certificate of Completion
Get your team access to 4,000+ top Udemy courses anytime, anywhere.Try Udemy for Business
- The new features in Spring Boot 2 and Spring Framework 5
- Spring MVC
- Spring Security & Thymeleaf
- Spring Data JPA
- Spring Boot Essentials
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.
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.
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.
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.
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.
In this lesson we are going to introduce Spring Data JPA. What is JPA, Hibernate and how does this all fit into our application?
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.
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.
Common Database Properties
H2 vs MySQL
Hibernate logging level DEBUG
If you can’t always remember what properties can be set in your application.properties there is a really good reference at the link below.
DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
H2 Web Console
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.
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.
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.
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.
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.
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.
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.
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
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")
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:
- 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
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
- 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.