Creating Spring Beans with Static Factory Methods

Spring beans are most commonly created through constructors or @Bean factory methods, but there is a third, lesser-known option: static factory methods. When a class uses the factory pattern to control its own instantiation — for example, a connection pool, a registry, or a singleton that validates its configuration at construction time — a static factory method lets Spring call that factory instead of a constructor. This keeps your code idiomatic and avoids adding unnecessary public constructors just to satisfy the IoC container.

Continue reading Creating Spring Beans with Static Factory Methods

Beyond string and number: Unlocking Power with TypeScript Literal Types

TypeScript’s primitive types — string, number, boolean — are broad buckets. A literal type narrows that bucket to exactly one value, like "north" instead of any string, or 42 instead of any number. On their own, literals look trivial. But combined with union types, template literal types, and discriminated unions, they form the backbone of the precise, self-documenting APIs that make TypeScript genuinely safer than JavaScript. This guide explores every facet of literal types with practical, real-world examples.

Continue reading Beyond string and number: Unlocking Power with TypeScript Literal Types

Top 40 Spring MVC Interview Questions and Answers (2025)

Spring MVC is the foundational web layer of the Spring Framework, and it remains a favourite topic in Java developer interviews at every level. Even in a world dominated by Spring Boot auto-configuration, interviewers probe Spring MVC knowledge to gauge whether a candidate truly understands what happens under the hood. This guide covers the 40 most-asked Spring MVC interview questions, organised from core concepts through advanced topics, each with a concise, interview-ready answer.

Continue reading Top 40 Spring MVC Interview Questions and Answers (2025)

How to Use Jersey Client to Call REST Services in Java

The Jersey Client API is the reference implementation of the JAX-RS 2.x/3.x client specification. It provides a fluent, type-safe way to consume REST endpoints from any Java application — no framework required beyond Jersey itself. In this guide you will learn how to perform every HTTP method, pass headers and query parameters, consume and produce JSON, add Basic and Bearer token authentication, and handle errors gracefully.

Continue reading How to Use Jersey Client to Call REST Services in Java

Resilience4j Circuit Breaker in Spring Boot: The Modern Replacement for Hystrix

Netflix Hystrix is in maintenance mode and has been since 2018. The modern replacement is Resilience4j — a lightweight, modular fault-tolerance library with first-class Spring Boot integration. In this guide you will implement all five core patterns — Circuit Breaker, Retry, Rate Limiter, Bulkhead, and TimeLimiter — in Spring Boot 3.x, with working configuration, the Hystrix-to-Resilience4j property mapping I wish I’d had during my own migration, and the three bugs that bite almost every team on day one.

Continue reading Resilience4j Circuit Breaker in Spring Boot: The Modern Replacement for Hystrix

Mastering Cache Control with ETag in Spring Boot RESTful APIs

An ETag (Entity Tag) is a short fingerprint — typically an MD5 or SHA hash of a resource’s content — that a REST API includes in every response. On the next request, the client sends the ETag back in a If-None-Match header. If the resource has not changed, the server replies with 304 Not Modified and an empty body, saving bandwidth and time. In this guide you will learn how ETags work, implement them from scratch in a Spring Boot REST API, and apply conditional updates to prevent lost updates in concurrent systems.

Continue reading Mastering Cache Control with ETag in Spring Boot RESTful APIs

Mastering Conversions Between Java LocalDate and ZonedDateTime

LocalDate stores only a calendar date — year, month, and day — with no time and no timezone. ZonedDateTime holds a fully resolved instant on the global timeline. Converting between the two is a surprisingly common requirement: form inputs, database date columns, and report parameters often arrive as plain dates that need to be combined with a time and a timezone before being stored or sent over an API. This guide covers every conversion direction with annotated code and a quick-reference table.

Continue reading Mastering Conversions Between Java LocalDate and ZonedDateTime