Category: Spring Boot
-

The Command Pattern in Java: Eliminating Fat Service Classes with Commands and Handlers
Fat Service classes are a liability — one class that does everything is a class that’s impossible to test and dangerous to change. This post shows how to apply the Command pattern in Java using Records, Repository interfaces, and single-responsibility Handlers to keep your business logic clean and isolated.
-

Spring Security 6 OAuth 2.1: Replacing Implicit Grant and ROPC with PKCE
If your Spring Security config still uses the Implicit Grant or Resource Owner Password flow, you’re running on borrowed time. This post breaks down why OAuth 2.1 makes PKCE mandatory, kills legacy flows, and shows the exact config difference between a legacy setup and a production-hardened one.
-

Spring @Transactional is Not Magic: The Proxy Trap and Why Your Data Isn’t Safe
**Most developers treat @Transactional like a magic wand, but it is actually a proxy-based abstraction that is remarkably easy to break.** If you do not understand Java AOP, you are likely creating “zombie data” and performance bottlenecks without even knowing it. This post deconstructs the **self-invocation trap**, the **rollback myth of checked exceptions**, and why…
-

SLF4J, Logback, and Log4j: A Straightforward Guide to Java Logging
The Java logging ecosystem features SLF4J as a facade API, with Logback and Log4j2 as underlying implementations. Using SLF4J decouples application code from logging frameworks, allowing easy dependency changes. For most projects, SLF4J with Logback is recommended, while Log4j2 is better for high-performance needs, ensuring efficient logging strategies.
-

Flyway vs. Liquibase: Which Database Migration Tool is Right for You?
Database migrations are essential in modern application development for managing schema changes. Flyway offers simplicity with raw SQL migrations, suitable for single-database projects. In contrast, Liquibase provides advanced features like changelogs and rollback support, making it ideal for database-agnostic applications. The choice depends on project requirements and team expertise.
-

Mastering Data Validation in Java Applications
The article emphasizes the importance of validating data before it enters the database to prevent issues like NullPointerExceptions and inconsistent data. It advocates for early validation at both the controller and domain model levels, using annotations and custom validators for cleaner, simpler code, ultimately leading to enhanced application reliability.
-

Multi-Environment Configuration in Spring Boot
In this article, I talk about the importance of proper configuration in Spring Boot applications across multiple environments. By using Maven profiles, environment variables, and CI/CD pipelines, developers can maintain clean and flexible configurations. The goal is to ensure a seamless application experience whether running locally or in production, without the risk of misconfigurations.
-

Optimize Your API Using Memoization
In this article I describe how to use the memoization to optimize the response time of a request. I explain how to prepare the code and how to apply the solution.
-

Solve the CORS error with Spring Security
In this article I explain how to configure the CORS allowed frontend in a Spring Boot application when using Spring Security.
-

Spring Security 6 with JWT Authentication
Let’s see how to use Spring Security 6 with JWT Authentication. I will do it using the Web Filters to handle JWT requests and credentials requests.
