Part 11 · 1 chapters · ~8 min

Capstone: The Ledger API in Java

The shared ledger capstone in Spring Boot with virtual threads, JPA or jOOQ, Flyway and Spring Kafka, a Quarkus native variant to compare start-up and memory, Testcontainers tests, JMH and JFR measurements, and an Istio sidecar deployment.

14

The build

code
ledger-java/
  src/main/java/bank/ledger/
    LedgerApplication.java          spring.threads.virtual.enabled=true
    transfers/TransferController.java, TransferService.java   records, @Valid, Idempotency-Key, ProblemDetail
    ledger/PostingService.java      @Transactional; SELECT ... FOR UPDATE ordered by id; balanced check
    payouts/PayoutStateMachine.java sealed states + exhaustive switch; rail client with timeouts; @Scheduled enquiry
  src/main/resources/db/migration   Flyway SQL
  src/test/java/...                 Testcontainers Postgres; 100 concurrent identical requests → one entry
variants
  quarkus/                          the same API on Quarkus; build -Dnative; compare start-up ms and RSS
  k8s/                              Deployment with Istio sidecar; VirtualService with a 90/10 canary
acceptance: identical to every language course (Go course part 10), plus JFR recording of a load test