Configuring the data source and object pool pattern
In the Spring Framework, DataSource is part of the JDBC API, and it provides a connection to the database. It hides many boilerplate codes for connection pooling, exception handling, and transaction management issues from the application code. As a developer, you let it focus on your business logic only. Don't worry about connection pooling, exception handling, and managing transactions; it is the responsibility of the application administrators how they set up the container managed data source in production. You just write the code, and test that code.
In an enterprise application, we can retrieve DataSource in several ways. We can use the JDBC driver to retrieve DataSource, but it is not the best approach to create DataSource in the production environment. As performance is one of the key issues during application development, Spring implements the object pool pattern to provide DataSource to the application in a very efficient way. The...