Introduction In this article, we are going to see how we can use the LazyConnectionDataSourceProxy with Spring Data JPA to acquire the database connection as late as possible and, therefore, reduce transaction response time. For an introduction to how Spring transactions manage database connections, check out this article as well. Service Layer Connection Management Let’s consider we have the following getAsCurrency service method: Because the getAsCurrency service method is annotated with the @Transactional(readOnly = true) annotation, Spring is going to acquire the database connection eagerly, as illustrated by the following sequence diagram:... Read More
The post How to use LazyConnectionDataSourceProxy with Spring Data JPA appeared first on Vlad Mihalcea.