public class DataSourceBuilder extends Object
DataSource
with common implementations and
properties. If Tomcat, HikariCP or Commons DBCP are on the classpath one of them will
be selected (in that order with Tomcat 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
.Constructor and Description |
---|
DataSourceBuilder(ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
DataSource |
build() |
static DataSourceBuilder |
create() |
static DataSourceBuilder |
create(ClassLoader classLoader) |
DataSourceBuilder |
driverClassName(String driverClassName) |
Class<? extends DataSource> |
findType() |
DataSourceBuilder |
password(String password) |
DataSourceBuilder |
type(Class<? extends DataSource> type) |
DataSourceBuilder |
url(String url) |
DataSourceBuilder |
username(String username) |
public DataSourceBuilder(ClassLoader classLoader)
public static DataSourceBuilder create()
public static DataSourceBuilder create(ClassLoader classLoader)
public DataSource build()
public DataSourceBuilder type(Class<? extends DataSource> type)
public DataSourceBuilder url(String url)
public DataSourceBuilder driverClassName(String driverClassName)
public DataSourceBuilder username(String username)
public DataSourceBuilder password(String password)
public Class<? extends DataSource> findType()
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.