Skip to main content

Decorator Design Pattern in Java: Complete Guide with Examples

The Decorator pattern adds behaviour to an object by wrapping it in another object that shares the same interface — without subclassing. Stack as many layers as you need; order matters. Complete Java guide: text processor pipeline, base decorator pattern, JDK I/O streams explained, when Decorator beats inheritance, and every layer shown step by step.

Composite Design Pattern in Java: Complete Guide with Examples

The Composite pattern lets you treat individual objects and collections of objects through the same interface — so a single file and a directory full of files both answer getSize() the same way. Complete Java guide: file system tree example, recursive traversal, when Composite fits vs when it's overkill, and real JDK usage (Swing component hierarchy, JSX-style trees).

Bridge Design Pattern in Java: Complete Guide with Examples

The Bridge pattern decouples abstraction from implementation so both can evolve independently. Without it, adding new device types and remote types requires N×M classes. With it: N+M. Complete Java guide: remote control example, when to use Bridge vs Adapter vs Strategy, real JDK usage (JDBC DriverManager, SLF4J), and the exact problem that makes you reach for it.

Adapter Design Pattern in Java: Complete Guide with Examples

The Adapter pattern wraps an incompatible interface so it fits the one your code expects — without touching either side. Complete Java guide: Object Adapter vs Class Adapter, payment gateway example with full runnable code, JDK real-world usage (InputStreamReader, Arrays.asList), and when to reach for it vs redesigning your interfaces.

Builder Design Pattern in Java: Complete Guide with Examples

The Builder pattern separates complex object construction from its representation, eliminating telescoping constructors and invalid partial state. Complete Java guide with runnable examples, Lombok @Builder, JDK usage (StringBuilder, Stream.Builder), pitfalls, and FAQs.

Spring Security 5 to 6 to 7 Migration: SecurityFilterChain, Lambda DSL, and the Silent Authorization Changes

Of every breaking change in the Spring Boot 2 → 3 era, the removal of WebSecurityConfigurerAdapter generated the most confused stack traces I've debugged — because security configuration is the one place where "it compiles and runs" tells you almost nothing about whether it still protects anything. This guide migrates Spring Security 5 configurations to the 6.x component model (Spring Boot 3.x), covers what tightens further in Spring Security 7 (Spring Boot 4), and flags the places where a mechanical conversion quietly changes your authorization behaviour.