Building Microservices REST APIs Using Spring Data REST

Spring Data REST allows application developers to quickly port an existing Spring Data Repository to the web as a RESTful microservice. This course will teach you how to master the microservices architecture using Spring Data REST.
Course info
Rating
(34)
Level
Intermediate
Updated
Jun 13, 2018
Duration
1h 22m
Table of contents
Description
Course info
Rating
(34)
Level
Intermediate
Updated
Jun 13, 2018
Duration
1h 22m
Description

At the core of rapidly developing microservices REST APIs is a thorough understanding of Spring Data REST. In this course, Building Microservices REST APIs Using Spring Data REST, you will learn the advanced skills needed to expose your application’s domain model as hypermedia-driven REST microservices. First, you will learn about the microservices architecture. Next, you will discover how to leverage Spring Data REST in your existing project and how to model complex entity relationships while leveraging advanced techniques like paging and sorting Finally, you'll take a look at how to implement custom search APIs, and you’ll even learn how to write effective integration tests so that small changes do not cause unexpected behavior in your APIs. When you’re finished with this course, you will have mastered the microservices architecture using Spring Data REST, which will help you as you create and document microservices and share REST APIs with your clients.

About the author
About the author

Kesha Williams is an award-winning software engineer with over 20 years' experience specializing in full0stack web development using Java, Spring, Angular and Amazon Web Services (AWS).

More from the author
Spring Boot Fundamentals
Intermediate
1h 38m
Jul 11, 2019
Spring Data Mongo: Getting Started
Intermediate
1h 10m
May 6, 2019
Data Transactions with Spring
Intermediate
56m
Dec 7, 2018
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Kesha Williams, and welcome to my course, Building Microservices REST APIs Using Spring Data REST. I am a software engineering manager at Chick-fil-A. Spring Data REST is one of Spring Data's most timesaving features. It is a module that allows application developers to quickly port an existing Spring Data repository to the web as a RESTful microservice. In this course, we are going to learn how to quickly standup RESTful microservices without any extra coding or configuration. It is actually pretty amazing. Some of the major topics that we will cover include: exposing your application's domain model using microservices, designing a system using the microservices architecture, modeling complex entity relationships, implementing custom search APIs, and writing effective integration tests and generating documentation. By the end of this course, you'll have a solid foundation for developing microservices using Spring Data REST, and transitioning huge monoliths to the microservices architecture. Before beginning the course, you should be familiar with Spring Data and Java. I hope you'll join me on this journey to learn Spring Data REST, with the Building Microservices REST APIs Using Spring Data REST course, at Pluralsight.

Mastering Microservices Architecture
We've seen software architecture patterns change and evolve over time, and the microservices architecture has dominated the headlines. It seems everywhere we turn this is a topic of discussion that causes a lot of buzz, and with good reason. This architecture pattern makes me very excited because it allows us to do more with less resources. I will highlight the benefits of the microservices architecture over the monolithic architecture, and highlight well-known industry use cases of the microservices architecture. We will also look at the steps to decompose a system into microservices based on business capabilities. After watching, you will have a solid foundation for building microservices REST APIs using Spring Data REST.

Exposing Microservices REST APIs
You will be amazed to see how easy Spring Data REST makes it to expose microservices. Spring Data REST builds on top of Spring Data repositories and automatically exports them as REST resources, also known as endpoints, so this is something to really get excited about. Before Spring Data REST came along, writing REST web services for a multi-domain object system was tedious and resulted in a lot of boilerplate code, and the use of annotations like RestController and RequestMapping in order to create APIs for simple CRUD operations. I'm sure you are familiar with these, but now they are no longer necessary. I will explain how Spring Data REST works, the modifications needed to the pom. xml Maven file to support Spring Data REST, how to discover resources, customizing resources, and we will even test our microservices using Postman.

Implementing Paging & Sorting
I'm going to teach you about how paging and sorting works when using Spring Data REST. If you recall, TrackZilla has a global reach with millions of users around the globe, which is why we are using the microservices architecture. TrackZilla users have asked for an easy way to get their ticket data out of the system. So we've given them the ticket management service. Since some customers have a large amount of ticket records, they'd like the ability to quickly page and sort, so let's get started. We will specifically look at influencing page return size and starting page number with URL parameters. We'll also look at navigation using previous and next navigational links, and sorting your results on a particular property.

Implementing Custom Search APIs
I will teach you how to implement custom search APIs with Spring Data REST, calling out specifics such as understanding the default search resource, adding custom finder methods to your Spring Data repositories, and adding paging to finder methods.

Leveraging Complex Relationships
During this module, you will see the TrackZilla application start to look like real microservices. You've seen the ticket management service, now I'm going to show you the ApplicationCatalog and the UserManagement microservices. I will teach you how to work with relationships between entities in Spring Data REST. I will show you how to represent multiple microservices in one IntelliJ project using modules, and I will also show you how to deploy multiple microservices at once.

Testing Microservices REST APIs
Unit and integration test are necessary conditions to clean code. Up to this point, we've been quickly testing our GET calls to our microservices using Postman. Let's explore writing end-to-end tests for TrackZilla using the TestRestTemplate to test our post, put, and delete CRUD operations. I will teach you how to write effective integration tests for your microservices REST APIs using TestRestTemplate so that changes do not cause unexpected behavior in other areas of your REST APIs.

Documenting Microservices REST APIs
So we've built microservices so that the users of TrackZilla can get their data out of this system. We've exposed information about applications, tickets, and people. So what's the best way to communicate to users of TrackZilla about the microservices and how to use them? We will use Swagger. I will teach you how to describe and document your microservices REST APIs using Swagger so that users of your REST APIs know how to interact with them. I will also teach you how to access the generated documentation via a web browser. We will add the Swagger dependency to the TrackZilla maven pom file, we will configure Swagger and the necessary Swagger annotations to describe our microservices REST APIs.