This video provides a brief introduction to microservices and how they work in a cloud native pattern.
- Before we get too deep into building Cloud-native applications with Spring Boot, I want to talk a little bit about microservices. Microservices are based on a very similar design pattern called services-oriented architecture. And in this pattern, essentially all of your data access and all of your business processes are accessed via services. Now, traditionally a services-oriented architecture was based on SOAP. Whereas microservices are traditionally based on REST.
Another distinct difference between services-oriented architecture and microservices are that in a microservices architecture, you're dealing with much more encapsulated domains. But there is still a key that everything is very loosely coupled. Now with this encapsulation of domains, we still want to deal with a single domain per service. But that service has a very distinct purpose as well. For instance, if we expose a service for accessing room data, we may also have a process service for dealing with the housekeeping around that room.
Really with microservices, we're talking about decomposition of an application and not just a component. Now, web applications in a microservices architecture, are treated themselves as distinct services. They should have an individual use and purpose. So, going back to that housekeeping example, we might have an application that displays the current status of all of the rooms that are clean. We might have another application that deals with dispatching a maid to go and actually clean that room.
In a microservices architecture, web applications rely on other backing services for processing and data access. Now you may ask, "Why does this matter for Spring, and where does Spring fit in?" Spring Boot itself was designed for two very clear purposes, and a microservices architecture is one of them. Now, in the Spring Cloud world, we're taking that Microservices architecture from Spring Boot but we're adding 12-factor plumbing to that application.
In this course we're going to be focusing on both. Not only the 12-factor plumbing, but also the microservices architectures. And we're going to be leveraging Spring Boot and Spring Cloud to do all of our work. In this course, we're going to really build three distinct types of services. The first one we'll be introduced with and the most common in this course is going to be Data microservices. We're going to deal with three specific domains and each of those domains will be exposed through data services.
We're also going to build a process microservice. This process microservice will aggregate all three of our data domains as well as expose those individual domains as appropriate. We're also going to build a web application and we're going to follow the same tenet of microservices when building our micro application. And this micro application will be a web app that displays the current status of all of the rooms in our hotel whether they are vacant or occupied on a given date and time.
Now, I do want to take a moment to talk about the RepositoryRestController. The RepositoryRestController annotation takes a traditional Spring Data repository and adds a proxy around that. And that proxy exposes all of those methods from the Spring Data repository as RESTful web services. In addition to exposing that Spring Data repository, It adds HATEOAS to the result. And specifically the HAL Implementation. With RepositoryRestController, we're exposing an entire data domain with very little code.
Now in this course, we're actually not going to be using the RepositoryRestController. Though in all honesty we very well could. The reason we're not is I don't want the hypermedia associated with HATEOAS to confuse what we're trying to focus on. And that really is the Spring Cloud abstractions. In the real world, if you were going to be writing mature REST services, hypermedia definitely is the way to go. But I don't really want to confuse what we're trying to do. And that is focusing on the Spring Cloud set of projects.
So let's get started!
- Setting up microservices
- Exposing and consuming external configurations
- Consuming services
- Isolating from failure