An open engineering handbook
Java & Software Architecture Knowledge Hub
Understand the concepts. Explore the diagrams. Build better software.
A handbook on Core Java, Spring, Spring Boot, persistence, security, testing, Spring Cloud microservices, design patterns, architecture, DDD and system design — with diagrams, runnable examples, trade-offs and quick checks.
This handbook explains why designs work, not only what they are called. Every article covers the problem, the core idea, diagrams and flows, a practical example, trade-offs, common mistakes, and a quick check (or interview questions) with answers. Key flows are interactive Archify diagrams you can zoom, explore through guided views and export.
What’s covered:
- Core Java: generics and type erasure, collections internals, exceptions, reflection and proxies, records, sealed types and pattern matching, the concurrency API, virtual threads, the Java Memory Model, garbage collection, lambdas and streams, modules, and concurrency design (safety and liveness, guarded methods, worker threads, futures, cancellation and pipelines).
- Spring:
- Core: IoC container, bean lifecycle and scopes, configuration, SpEL, AOP, events.
- Boot: auto-configuration, externalized configuration, Actuator.
- Web: MVC, REST and Problem Details, WebFlux.
- Data: JPA and Hibernate, fetching, JPQL and Criteria, transactions, migrations, caching.
- Security: the filter chain, OAuth2/OIDC/JWT, method security.
- Testing: JUnit and Mockito, Testcontainers.
- Microservices: service discovery, API gateway, centralized configuration, Resilience4j, observability with Micrometer and OpenTelemetry, and event-driven services with Spring Cloud Stream, Kafka and RabbitMQ.
- Design patterns: all 23 GoF patterns with runnable Java 21 examples, the OO design principles behind them, compound patterns (MVC) and side-by-side comparisons.
- Data-intensive systems: storage engines, encoding, replication, partitioning, transactions and isolation, distributed-systems faults, consistency and consensus, batch and stream processing.
- System design: an 18-step framework, building blocks (load balancing, caching, consistent hashing, CAP, databases, IDs, queues, real-time push, deployment, security) and 18 case studies with interactive Archify diagrams (order management, URL shortener, rate limiter, payment system, proximity service, chat, news feed, notifications, video streaming, web crawler, autocomplete, key-value store, collaborative editing, stock exchange, ride sharing, metrics and alerting, flash sale, file sync).
- Microservices data patterns: sagas, transactional outbox and inbox, CQRS and event sourcing, and idempotency.
- Software architecture, hexagonal architecture and DDD.
- Self Review & Quick Check: questions for every area, a service review checklist and a quick reference.
Other details:
- Versions: Java examples target Java 21 LTS, with Java 25 LTS and 27 features labelled. Spring examples target Spring Boot 4.1 (Spring Framework 7). Code included from source files is compiled and run by CI on every build.
- Honest trade-offs: no pattern or architecture style is presented as universally best. Each article says when not to use what it describes.
- Planned topics: the handbook grows in batches, and section pages list the topics that are planned but not written yet.
Start here
- Concurrency APIPractical java.util.concurrent: threads vs tasks, ExecutorService and thread-pool sizing, Future and CompletableFuture composition and error handling, locks (synchronized, ReentrantLock, ReadWriteLock, StampedLock), atomics and LongAdder, synchronizers, concurrent collections and BlockingQueue, and how they relate to virtual threads.
- ApplicationContext & BeanFactoryHow the Spring IoC container works: BeanFactory vs ApplicationContext, bean definitions, the refresh() startup sequence, BeanFactoryPostProcessor and BeanPostProcessor extension points, dependency resolution (by type, @Qualifier, @Primary, collections, ObjectProvider), circular dependencies, context hierarchies, and AOT processing.
- Auto-configuration & conditionsHow Spring Boot auto-configuration works: starters, @EnableAutoConfiguration, the AutoConfiguration.imports file, ordering, the full family of @ConditionalOn* annotations, back-off with @ConditionalOnMissingBean, the conditions evaluation report, Spring Boot 4 modular auto-configuration, and writing your own starter.
- TransactionsHow Spring manages transactions: ACID, PlatformTransactionManager, how @Transactional works through proxies, rollback rules, all seven propagation behaviours with use cases, isolation levels and anomalies, read-only transactions, timeouts, optimistic and pessimistic locking, programmatic TransactionTemplate, and transactions with messaging.
- Security filter chainHow Spring Security works inside: DelegatingFilterProxy and FilterChainProxy, multiple SecurityFilterChain beans and matchers, the important filters in order, AuthenticationManager and providers, SecurityContext and its storage, ExceptionTranslationFilter, authorization with AuthorizationManager, CSRF and CORS, password storage, and what changed in Spring Security 7 (lambda DSL only, MFA).
- Circuit breakers (Resilience4j)Keeping services up when dependencies fail: timeouts, retries with backoff and jitter, circuit breaker states and configuration, bulkheads, rate limiters and time limiters with Resilience4j in Spring Boot, the Spring Cloud CircuitBreaker abstraction, Spring Framework 7's built-in @Retryable and @ConcurrencyLimit, fallbacks, ordering of patterns, and monitoring.
- SOLID PrinciplesThe five SOLID principles with Java examples: what each one actually says, the problem it prevents, how it connects to design patterns, and how to avoid applying it dogmatically.
- DecoratorAdd responsibilities to an object dynamically by wrapping it in objects with the same interface. A runnable Java 21 HTTP client stacked with logging, caching and retry decorators, why order matters, java.io as the classic example, Decorator versus inheritance and proxies.
- Transactions and isolationWhat ACID really guarantees, and the concurrency anomalies each isolation level allows: dirty reads and writes, read skew, lost updates, write skew and phantoms. Read committed, snapshot isolation and MVCC, preventing lost updates, and the three ways to get serializability: serial execution, two-phase locking and serializable snapshot isolation.
- Caching strategiesWhere to cache (client, CDN, application, distributed cache, database), read strategies (cache-aside, read-through) and write strategies (write-through, write-around, write-back), invalidation and TTLs, eviction policies, cache penetration with Bloom filters, stampedes and avalanches, Redis versus Memcached, and why Redis is fast.
- Payment SystemA payment system designed with the 18-step framework: pay-in and pay-out flows, payment service, executor, PSP integration with hosted payment pages, wallet and double-entry ledger, exactly-once execution through retries plus idempotency keys, handling unknown outcomes, reconciliation with settlement files, clearing and settlement, and payment security.
- Chat SystemA one-to-one and group chat system designed with the 18-step framework: WebSocket gateways and a session registry, message IDs and per-chat ordering, store-then-fan-out delivery, offline sync and push notifications, delivery receipts, presence, media, end-to-end encryption, and storing trillions of messages in a wide-column store.
- Saga patternHow to keep data consistent across microservices without distributed transactions: sagas as sequences of local transactions with compensating actions, choreography versus orchestration, designing compensations, pivot and retriable steps, isolation anomalies and countermeasures, and implementing an orchestrated saga in Spring Boot.
- Layered vs HexagonalHow classic layered architecture and Hexagonal Architecture (Ports and Adapters) differ in dependency direction, testability and cost — what ports and adapters are, why each port exists, and when a simple layered design is enough.
- Quick checkOver 90 short self-review questions with answers across Core Java (generics, collections, concurrency, JMM, GC, streams, modules, modern features), Spring Core, Spring Boot and web, data and transactions, security and testing, and Spring Cloud microservices.
Explore by topic
- Learning PathsSix ordered routes through the handbook, from Java fundamentals to system design interviews.
- Design PatternsThe 23 Gang of Four patterns, the SOLID principles behind them, and when each pattern helps or hurts.
- JavaJava from the JVM up: language fundamentals, concurrency, memory and performance — targeting Java 21 LTS.
- SpringSpring Framework and Spring Boot, from inversion of control to production readiness.
- Software ArchitectureFundamentals, quality attributes, trade-offs and architecture styles — none of them universally best.
- Hexagonal ArchitecturePorts and Adapters: keeping business rules independent of web, database and external services.
- Domain-Driven DesignStrategic and tactical DDD, taught with one running order-management example.
- MicroservicesService boundaries, communication, reliability, distributed data and operations — and when not to use microservices.
- System DesignA repeatable framework for designing systems, reusable diagram building blocks, and worked case studies.
- Data-Intensive SystemsHow databases, replication, partitioning, transactions, consensus, batch and stream processing really work — the foundations behind every system design decision about data.
- ComparisonsSide-by-side comparisons of patterns and architecture styles that are often confused.
- Self ReviewCheck your understanding of Core Java, Spring, Spring Boot, persistence, security, testing and microservices with quick-check questions, a service review checklist and a one-page quick reference.
Recently reviewed
- Abstract FactoryCreate families of related objects that must be used together, without naming their concrete classes. A runnable Java 21 example builds SQL for PostgreSQL and MySQL from one client, plus how Abstract Factory differs from Factory Method, trade-offs and interview questions.
- Auto-configuration & conditionsHow Spring Boot auto-configuration works: starters, @EnableAutoConfiguration, the AutoConfiguration.imports file, ordering, the full family of @ConditionalOn* annotations, back-off with @ConditionalOnMissingBean, the conditions evaluation report, Spring Boot 4 modular auto-configuration, and writing your own starter.
- Circuit breakers (Resilience4j)Keeping services up when dependencies fail: timeouts, retries with backoff and jitter, circuit breaker states and configuration, bulkheads, rate limiters and time limiters with Resilience4j in Spring Boot, the Spring Cloud CircuitBreaker abstraction, Spring Framework 7's built-in @Retryable and @ConcurrencyLimit, fallbacks, ordering of patterns, and monitoring.
- Event-driven (Cloud Stream, Kafka, RabbitMQ)Building event-driven Spring services: events vs commands, Kafka vs RabbitMQ, Spring Cloud Stream's functional model (Supplier, Function, Consumer bindings), consumer groups and partitioning, error handling with retries and dead-letter queues, Spring for Apache Kafka and Spring AMQP directly, the transactional outbox, idempotent consumers, schemas, and testing.
- Java Memory ModelWhy concurrent Java code can see stale or reordered values: CPU caches and reordering, the Java Memory Model, happens-before rules, volatile, synchronized and final semantics, safe publication, double-checked locking, data races vs race conditions, and the JVM runtime memory areas (heap, stack, metaspace).
- Observability (Micrometer, OTel)Observing Spring microservices: the three signals (metrics, traces, logs) and how they connect, Micrometer meters and the Observation API, distributed tracing concepts (trace, span, context propagation, W3C traceparent), Spring Boot 4 OpenTelemetry starter and OTLP export, log correlation, sampling, the OTel Collector, dashboards and SLO alerts, and cardinality pitfalls.