How java-techie-jt/feign-client-demo works
Step 1: Identify the project type and purpose
• This is a simple two-microservice demo built with Spring Boot and Spring Cloud OpenFeign (“feign-client-demo”).
• course-service exposes a REST API to retrieve course data from an in-memory JSON file.
• student-service exposes a REST API to retrieve student information and enrich it by calling course-service via a Feign client.
Step 2: Analyze the file structure
• Top-level: two Maven modules, course-service and student-service.
• Each module follows standard Spring Boot layout:
• src/main/java/com/javatechie/{…}
• controller, service, dto (data transfer objects), client (in student-service)
• src/main/resources holds application configuration and, for course-service, courses.json
• No gateway or discovery server—services communicate directly via Feign.
Step 3: Examine the README for additional insights
• The README only names the project. But file names (CourseClient, CourseRestClientService) confirm use of Feign for inter-service calls.
a. Main components
1. Client (Postman, Web UI, etc.)
2. student-service
– StudentController
– StudentService
– Feign Client (CourseClient/CourseRestClientService)
3. course-service
– CourseController
– CourseService
– courses.json data store
4. External dependencies: HTTP over TCP/IP
b. Relationships and interactions
• Client → StudentController (HTTP GET /students/{id})
• StudentController → StudentService → CourseClient (Feign) → CourseController on course-service
• CourseController → CourseService → courses.json
c. Architectural patterns/design principles
• Microservices (two independent deployable services)
• Layered architecture inside each service: Controller → Service → Data (file store)
• Declarative REST client (Spring Cloud OpenFeign) for inter-service communication
• Externalized configuration (application.properties / yml)
d. Relevant technologies/frameworks
• Spring Boot
• Spring Web (REST controllers)
• Spring Cloud OpenFeign
• Maven (pom.xml)
• In-memory JSON data source for demo
• For this microservice demo:
• Ports (e.g., 8080 for student-service, 8081 for course-service) if known.
• Feign client in student-service pointing to course-service’s REST endpoint.
• Clear labels for each service and inner component (“CourseController”, “StudentService”, etc.).
• Blue rectangles for services
• Green for controllers
• Yellow for service/business logic
Step 7: Be detailed—capture all essential elements
• Exactly which DTO classes flow across the boundary (Course, Rating).
• Configuration files driving ports or endpoints (application.properties/yml).
[Client]
|
v
[Student-Service]
├─ StudentController
├─ StudentService
└─ FeignClient → (HTTP GET) → [Course-Service]
├─ CourseController
├─ CourseService
└─ courses.json datastore