Spring framework provides set of libraries for creating microservices in Java. They are a part of Spring Cloud project. Today I’m going to show you how to create simple microservices using Spring Boot and following technologies:
- Zuul – gateway service that provides dynamic routing, monitoring, resiliency, security, and more
- Ribbon – client side load balancer
- Feign – declarative REST client
- Eureka – service registration and discovery
- Sleuth – distributed tracing via logs
- Zipkin – distributed tracing system with request visualization.
Sample application is available at https://github.com/piomin/sample-spring-microservices.git. Here’s picture with application architecture. Client calls endpoint available inside customer-service which stores basic customer data via Zuul gateway. This endpoint interacts with account-service to collect information about customer accounts served by endpoint in account-service. Each service registering itself on Eureka discovery service and sending its logs to Zipkin using spring-cloud-sleuth.
This is account-service controller. We use findByCustomer method for collecting customer accounts by his id.
This is…
View original post 408 more words