Lazy JDBC Connections in Spring Boot 4.1 (Performance Win)

One property change took connection hold time from 2 seconds down to 15 milliseconds. Lazy JDBC connections in Spring Boot 4.1 is a feature you need to know about, and I'll prove the performance difference with real metrics. In this video, we walk through the new spring.datasource.connection-fetch=lazy property in Spring Boot 4.1. We build a complete demo application with Spring Data JDBC, Postgres, Docker Compose, and Spring Boot Actuator to measure the real-world difference between eager and lazy connection fetching. You'll see exactly when this optimization matters and when it won't help. How eager vs lazy JDBC connection fetching works inside @Transactional methods How to enable lazy connections with a single property: spring.datasource.connection-fetch=lazy Building a demo app with Spring Data JDBC, Postgres, Docker Compose, and Actuator metrics Measuring real performance differences using Micrometer metrics via the Actuator endpoint When lazy connections pay off (slow remote calls before writes) and when they don't If you learned something new, smash that thumbs up, subscribe for more Spring Boot 4.1 content, and drop a comment telling me which feature you want me to cover next! 0:00 - The 2 seconds to 15ms result 0:20 - Intro & Spring Boot 4.1 overview 1:15 - Release notes & release highlights page 2:00 - GitHub repo & what we're building 2:50 - Eager vs Lazy connection explained 3:40 - Generating the project on start.spring.io 5:00 - Schema, Customer record & repository setup 6:30 - Building the slow remote client 8:00 - Registration service with @Transactional 9:00 - REST controller endpoint 9:45 - Testing with eager (default) — 2.2 second hold 11:00 - Switching to lazy — 15ms hold time 12:00 - When to use lazy connections (and when not to) 13:00 - Wrap up & what's next 🔗Resources & Links mentioned in this video: GitHub Repository — Lazy JDBC Connections Demo: https://github.com/danvega/jdbc-lazy-... Spring Boot 4.1 Blog Post: https://spring.io/blog/2026/06/10/spr... Spring Boot 4.1 Release Notes: https://github.com/spring-projects/sp... Spring Release Highlights: https://spring.io/projects/release-hi... 👋🏻Connect with me: Website: https://www.danvega.dev Twitter:   / therealdanvega   Github: https://github.com/danvega LinkedIn:   / danvega   Newsletter: https://www.danvega.dev/newsletter SUBSCRIBE TO MY CHANNEL: http://bit.ly/2re4GH0 ❤️