Skip to content

Spring Boot tutorial: bidirectional microservices using Eureka, Feign, gRPC, and Hibernate.

License

Notifications You must be signed in to change notification settings

sumedhahire/spring-boot-eureka-grpc-feign-simplified

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

springboot-microservices-eureka-grpc-feign-tutorial

tutorial spring boot eureka grpc feign hibernate

A compact hands-on tutorial (its simple rest assure). Two Spring Boot services register with Eureka and communicate using Feign (REST) and gRPC.

Table of contents


Overview

Notes on modules:

Notes on modules:

  • common-lib: Shared models used by both gRPC and Feign clients for type consistency.
  • order: Provides REST and gRPC endpoints; also consumes endpoints from product.
  • product: Provides REST and gRPC endpoints; also consumes endpoints from order.
  • eureka-server: Handles service registration and discovery, enabling both applications to find each other dynamically.

This design allows bidirectional communication between order and product via Feign (REST) and gRPC, with all shared data models maintained in common-lib.

Prerequisites

  • Java 17+
  • Maven 3.8+
  • docker & docker-compose (optional)
  • grpcurl (optional)

Repo structure

microservices/
├── eureka-server/
├── order/       # feign client + grpc client
├── product/       # rest + grpc server
└── common-proto/    # hello.proto

Quickstart (one-command)

git clone https://github.com/sumedhahire/spring-boot-eureka-simplified
./mvnw -pl eureka-service,order,product clean package -DskipTests

Eureka UI: http://localhost:8761

Run manually

  1. Start Eureka:
    cd eureka-server
    ./mvnw spring-boot:run
  2. Start service-b (provider):
    cd ../product
    ./mvnw spring-boot:run
  3. Start service-a (consumer):
    cd ../order
    ./mvnw spring-boot:run

Test examples

Feign (REST)

curl http://localhost:8080/hello/feign
# {"message":"Hello from service-b (rest)"}

gRPC

grpcurl -plaintext -d '{"name":"sumedh"}' localhost:9090 hello.HelloService/SayHello
# {"message":"Hello sumedh from gRPC"}

Contributing

Use labels: good first issue, enhancement, bug. Keep PRs small and reference the step affected.

License

MIT. See LICENSE.

Notes

GitHub strips <style> and many attributes. This HTML uses supported tags only so it renders inside README.md. For a full HTML/CSS page host it via GitHub Pages and put the file in /docs or use the gh-pages branch.