Skip to main content

4 posts tagged with "Spring"

Spring Framework related content

View All Tags

Lazy JDBC Connections in Spring Boot 4.1 (Performance Win)

· 7 min read
Ouwesh Seeroo
Senior Java Developer | Tech Enthusiast

Every time a @Transactional method runs in your Spring Boot application, Spring grabs a JDBC connection from the pool. Immediately. Before your code even executes. Before it knows whether you'll actually touch the database. That connection sits there, reserved for you, doing absolutely nothing — while some other thread might be blocked waiting for a free connection. Your Hibernate second-level cache just returned the result from memory? Doesn't matter. Connection was already checked out. That's the equivalent of renting a car to walk across the street.

Spring Boot 4.1 fixes this with first-class support for lazy JDBC connections. One property. Massive performance win.

In this post we'll look at:

  • The problem with eager connections — why Spring grabs a connection before you need one
  • What LazyConnectionDataSourceProxy does — the mechanism behind lazy fetching
  • Spring Boot 4.1's auto-configuration — enabling it with a single property
  • Before vs after — what you had to do manually (and why nobody bothered)
  • Real-world scenarios where this shines — cache hits, conditional logic, and read/write routing

Building a Flexible Calculator Engine with Strategy and Factory Patterns in Spring Boot

· 3 min read
Ouwesh Seeroo
Senior Java Developer | Tech Enthusiast

In this article, we'll explore how to build a flexible and maintainable calculator engine using the Strategy and Factory design patterns in a Spring Boot application. This pattern is particularly useful when you need to apply different calculation rules based on different jurisdictions or conditions.