Building Spring Boot RESTful Microservice

In this chapter, we will be building a RESTful atomic microservice that performs CRUD operations on in-memory databases (either HSQL or H2) using Spring Cloud and Spring Data. This service will be enabled for service discovery registration to the Eureka Server as we have created in Chapter 5, Spring Cloud Netflix and Service Discovery; and configures the service through bootstrap.yml and application.yml.

In the previous chapter, we learned about microservice architecture and its advantages and challenges. We also created the Eureka Server and Eureka Client, and registered this Client with Eureka Server. But in this chapter, we are going to create a simple microservice example using Spring Boot and Cloud.

At the end of this chapter, you will have a better understanding of microservices and how to create a simple microservice that focuses on a targeted situation rather than solving too many problems. This chapter will cover the following points:

  • Microservices with Spring Boot
  • A simple microservice example:
    • Brief introduction to Spring Data
    • Brief introduction to bootstrap.yml and application.yml
  • Developing a simple microservices example
  • Creating discovery server:
    • @EnableEurekaServer
  • Creating microservice (the Producer):
    • @EnableEurekaClient
    • @EnableDiscoveryClient
    • @RestController
  • Creating microservice consumers
  • @SpringBootApplication and @SpringCloudApplication

Let's see these topics in detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.128.145