This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Use all skills from the .claude/.agents/skills direcotry.
Maven multi-module project demonstrating Spring Cloud microservices patterns, used as a course repository with 5 progressive modules.
# Build entire project with tests
mvn clean verify
# Build without tests
mvn clean install -DskipTests
# Run a specific service
mvn -pl <module>/<service> spring-boot:run
# Examples:
mvn -pl config-and-discovery/discovery-server spring-boot:run
mvn -pl inter-communication/inter-caller-service spring-boot:run
mvn -pl api-gateway/gateway-service spring-boot:run
# Build Docker image (intro module only, uses Jib)
mvn jib:build -pl intro-to-spring-boot
# Run SonarCloud analysis
mvn verify sonar:sonar# ELK stack for intro-to-spring-boot (Elasticsearch:9200, Logstash:5000, Kibana:5601)
docker-compose -f intro-to-spring-boot/docker-compose.yml up
# Gateway infrastructure (Redis:6379, Eureka discovery:8761)
docker-compose -f api-gateway/docker-compose.yml up- Spring Boot: 4.0.3 | Spring Cloud: 2025.1.1 | Java: 21
- Language: Kotlin 2.3.10 (primary), some Java
- Build: Maven 3.9+, Jib plugin for Docker, Jacoco for coverage
| Module | Services | Key Tech |
|---|---|---|
intro-to-spring-boot |
simple-service | Spring Web, Prometheus metrics, ELK logging |
config-and-discovery |
config-server, discovery-server, caller-service, callme-service | Eureka, Spring Cloud Config |
inter-communication |
inter-caller-service, inter-callme-service | OpenFeign, HTTP Service Interface, WebFlux, Resilience4j, OpenTelemetry |
api-gateway |
gateway-service | Spring Cloud Gateway (WebFlux), Redis rate limiting, circuit breaker |
event-driven |
producer-service, consumer-a-service, consumer-b-service | Spring Cloud Stream, RabbitMQ |
Service Discovery: Eureka Server in config-and-discovery/discovery-server. Services register by name; clients resolve addresses dynamically.
Inter-Service Communication (3 approaches in inter-communication):
- OpenFeign — Declarative client via
@FeignClient(name = "inter-callme-service", path = "/callme") - HTTP Service Interface — Spring 6.1+ native
@HttpExchange/@PostExchangeannotations (seeCallmeService.kt) - Custom WebFlux client — Reactive with weighted response-time load balancing (
WeightedTimeResponseLoadBalancer.kt)
API Gateway: Reactive Spring Cloud Gateway with Redis-backed rate limiting, Resilience4j circuit breaker, and path-based routing to downstream services.
Event-Driven: Spring Cloud Stream abstraction over RabbitMQ. Producer partitions events by ID; consumers use named groups for independent processing.
Observability Stack:
- Metrics: Micrometer → Prometheus
- Tracing: OpenTelemetry → Zipkin
- Logging: Logstash encoder → Elasticsearch → Kibana
All services follow: pl.piomin.samples.<module-name>.*
Example: pl.piomin.samples.caller.*, pl.piomin.samples.callme.*
Key differences vs Spring Boot 3.x relevant to this codebase:
TestRestTemplateremoved — UseMockMvcbuilt fromWebApplicationContextviaMockMvcBuilders.webAppContextSetup(context).build()@AutoConfigureMockMvcremoved — The entirespring-boot-test-autoconfigure.webslice is gone; wireWebApplicationContextmanually in testsspringdoc-openapi2.x incompatible —WebMvcPropertieswas removed; usespringdoc-openapi 3.x(currently3.0.2)git-commit-id-plugin(groupIdpl.project13.maven) deprecated; useio.github.git-commit-id:git-commit-id-maven-plugin(managed by Spring Boot BOM)- Virtual threads — Enable with
spring.threads.virtual.enabled: true; useCopyOnWriteArrayListfor shared mutable state - Spring Cloud 2025.0.x incompatible with Spring Boot 4 —
LifecycleMvcEndpointAutoConfigurationreferences removedorg.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; Spring Cloud 2025.1.1+ (spring-cloud-context 5.x) is required - Spring Cloud 2025.1.1 API changes —
ReactorServiceInstanceLoadBalancer.choose()signature changed fromRequest<*>?toRequest<Any>;configureDefaultlambdaidparameter is now non-nullableString @MockBean→@MockitoBean— Useorg.springframework.test.context.bean.override.mockito.MockitoBean; pair withmockito-kotlinfor idiomatic Kotlin usageMockRestServiceServerwith load-balancedRestTemplate— UsecontainsString("/path")matcher since LB resolves service names tohost:port@WebFluxTestremoved — UseWebTestClient.bindToController(MyController()).build()for standalone WebFlux controller tests (no Spring context needed, no Redis/Eureka required)- Jackson 3.0 — Package renamed from
com.fasterxml.jackson→tools.jackson(e.g.tools.jackson.databind.ObjectMapper). Spring Boot 4 shipstools.jackson.core:jackson-databind:3.0.x. Thespring-boot-starter-jsonstarter was renamed tospring-boot-starter-jackson - Spring Cloud Stream test binder —
InputDestination.send(msg, name)andOutputDestination.receive(timeout, name)use the destination name (e.g.callme-events), not the binding name (e.g.callmeEventConsumer-in-0)
- CircleCI runs Maven tests and SonarCloud analysis on each push
- Renovate manages automated dependency updates (configured in
renovate.json)