Mention HikariCP next to DBCP and C3P0 in connection pool notes
Closes gh-24405
This commit is contained in:
parent
d085577e0a
commit
60c7af3625
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -52,12 +52,13 @@ import org.springframework.util.ClassUtils;
|
|||
* {@link org.springframework.mock.jndi.SimpleNamingContextBuilder}, or switch the
|
||||
* bean definition to a local DataSource (which is simpler and thus recommended).
|
||||
*
|
||||
* <p>If you need a "real" connection pool outside of a Java EE container, consider
|
||||
* <p>This {@code DriverManagerDataSource} class was originally designed alongside
|
||||
* <a href="https://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a>
|
||||
* or <a href="https://sourceforge.net/projects/c3p0">C3P0</a>.
|
||||
* Commons DBCP's BasicDataSource and C3P0's ComboPooledDataSource are full
|
||||
* connection pool beans, supporting the same basic properties as this class
|
||||
* plus specific settings (such as minimal/maximal pool size etc).
|
||||
* and <a href="https://sourceforge.net/projects/c3p0">C3P0</a>, featuring bean-style
|
||||
* {@code BasicDataSource}/{@code ComboPooledDataSource} classes with configuration
|
||||
* properties for local resource setups. For a modern JDBC connection pool, consider
|
||||
* <a href="https://github.com/brettwooldridge/HikariCP">HikariCP</a> instead,
|
||||
* exposing a corresponding {@code HikariDataSource} instance to the application.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 14.03.2003
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -40,12 +40,13 @@ import org.springframework.util.Assert;
|
|||
* ApplicationContext via {@link org.springframework.jndi.JndiObjectFactoryBean},
|
||||
* for seamless switching to and from a local DataSource bean like this class.
|
||||
*
|
||||
* <p>If you need a "real" connection pool outside of a Java EE container, consider
|
||||
* <p>This {@code SimpleDriverDataSource} class was originally designed alongside
|
||||
* <a href="https://commons.apache.org/proper/commons-dbcp">Apache Commons DBCP</a>
|
||||
* or <a href="https://sourceforge.net/projects/c3p0">C3P0</a>.
|
||||
* Commons DBCP's BasicDataSource and C3P0's ComboPooledDataSource are full
|
||||
* connection pool beans, supporting the same basic properties as this class
|
||||
* plus specific settings (such as minimal/maximal pool size etc).
|
||||
* and <a href="https://sourceforge.net/projects/c3p0">C3P0</a>, featuring bean-style
|
||||
* {@code BasicDataSource}/{@code ComboPooledDataSource} classes with configuration
|
||||
* properties for local resource setups. For a modern JDBC connection pool, consider
|
||||
* <a href="https://github.com/brettwooldridge/HikariCP">HikariCP</a> instead,
|
||||
* exposing a corresponding {@code HikariDataSource} instance to the application.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.5
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -20,13 +20,13 @@ import javax.sql.DataSource;
|
|||
|
||||
/**
|
||||
* {@code DataSourceFactory} encapsulates the creation of a particular
|
||||
* {@link DataSource} implementation such as a
|
||||
* {@link org.springframework.jdbc.datasource.SimpleDriverDataSource
|
||||
* SimpleDriverDataSource} or a connection pool such as Apache DBCP or C3P0.
|
||||
* {@link DataSource} implementation such as a non-pooling
|
||||
* {@link org.springframework.jdbc.datasource.SimpleDriverDataSource}
|
||||
* or a HikariCP pool setup in the shape of a {@code HikariDataSource}.
|
||||
*
|
||||
* <p>Call {@link #getConnectionProperties()} to configure normalized
|
||||
* {@code DataSource} properties before calling {@link #getDataSource()} to
|
||||
* actually get the configured {@code DataSource} instance.
|
||||
* {@code DataSource} properties before calling {@link #getDataSource()}
|
||||
* to actually get the configured {@code DataSource} instance.
|
||||
*
|
||||
* @author Keith Donald
|
||||
* @author Sam Brannen
|
||||
|
|
@ -35,14 +35,14 @@ import javax.sql.DataSource;
|
|||
public interface DataSourceFactory {
|
||||
|
||||
/**
|
||||
* Get the {@linkplain ConnectionProperties connection properties} of the
|
||||
* {@link #getDataSource DataSource} to be configured.
|
||||
* Get the {@linkplain ConnectionProperties connection properties}
|
||||
* of the {@link #getDataSource DataSource} to be configured.
|
||||
*/
|
||||
ConnectionProperties getConnectionProperties();
|
||||
|
||||
/**
|
||||
* Get the {@link DataSource} with the {@linkplain #getConnectionProperties
|
||||
* connection properties} applied.
|
||||
* Get the {@link DataSource} with the
|
||||
* {@linkplain #getConnectionProperties connection properties} applied.
|
||||
*/
|
||||
DataSource getDataSource();
|
||||
|
||||
|
|
|
|||
|
|
@ -3613,20 +3613,20 @@ part of the JDBC specification and is a generalized connection factory. It lets
|
|||
container or a framework hide connection pooling and transaction management issues
|
||||
from the application code. As a developer, you need not know details about how to
|
||||
connect to the database. That is the responsibility of the administrator who sets up
|
||||
the datasource. You most likely fill both roles as you develop and test code, but you do
|
||||
not necessarily have to know how the production data source is configured.
|
||||
the datasource. You most likely fill both roles as you develop and test code, but you
|
||||
do not necessarily have to know how the production data source is configured.
|
||||
|
||||
When you use Spring's JDBC layer, you can obtain a data source from JNDI, or you can configure your
|
||||
own with a connection pool implementation provided by a third party. Popular
|
||||
implementations are Apache Jakarta Commons DBCP and C3P0. Implementations in the Spring
|
||||
distribution are meant only for testing purposes and do not provide pooling.
|
||||
When you use Spring's JDBC layer, you can obtain a data source from JNDI, or you can
|
||||
configure your own with a connection pool implementation provided by a third party.
|
||||
Traditional choices are Apache Commons DBCP and C3P0 with bean-style `DataSource` classes;
|
||||
for a modern JDBC connection pool, consider HikariCP with its builder-style API instead.
|
||||
|
||||
This section uses Spring's `DriverManagerDataSource` implementation, and several
|
||||
additional implementations are covered later.
|
||||
NOTE: You should use the `DriverManagerDataSource` and `SimpleDriverDataSource` classes
|
||||
(as included in the Spring distribution) only for testing purposes! Those variants do not
|
||||
provide pooling and perform poorly when multiple requests for a connection are made.
|
||||
|
||||
NOTE: You should use the `DriverManagerDataSource` class only for testing purposes,
|
||||
since it does not provide pooling and performs poorly when multiple requests for a
|
||||
connection are made.
|
||||
The following section uses Spring's `DriverManagerDataSource` implementation.
|
||||
Several other `DataSource` variants are covered later.
|
||||
|
||||
To configure a `DriverManagerDataSource`:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue