T
- type of DataSource produced by the builderpublic final class DataSourceBuilder<T extends DataSource> extends Object
DataSource
with common implementations and
properties. If HikariCP, Tomcat, Commons DBCP or Oracle UCP are on the classpath one of
them will be selected (in that order with Hikari first). In the interest of a uniform
interface, and so that there can be a fallback to an embedded database if one can be
detected on the classpath, only a small set of common configuration properties are
supported. To inject additional properties into the result you can downcast it, or use
@ConfigurationProperties
.Modifier and Type | Method and Description |
---|---|
T |
build() |
static DataSourceBuilder<?> |
create() |
static DataSourceBuilder<?> |
create(ClassLoader classLoader) |
DataSourceBuilder<T> |
driverClassName(String driverClassName) |
static Class<? extends DataSource> |
findType(ClassLoader classLoader) |
DataSourceBuilder<T> |
password(String password) |
<D extends DataSource> |
type(Class<D> type) |
DataSourceBuilder<T> |
url(String url) |
DataSourceBuilder<T> |
username(String username) |
public static DataSourceBuilder<?> create()
public static DataSourceBuilder<?> create(ClassLoader classLoader)
public T build()
public <D extends DataSource> DataSourceBuilder<D> type(Class<D> type)
public DataSourceBuilder<T> url(String url)
public DataSourceBuilder<T> driverClassName(String driverClassName)
public DataSourceBuilder<T> username(String username)
public DataSourceBuilder<T> password(String password)
public static Class<? extends DataSource> findType(ClassLoader classLoader)