public class DataSourceBuilder extends java.lang.Object
NOTE: Forked from Spring Boot logic to avoid hard dependency on Boot.
Convenience class for building a javax.sql.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
.
Modifiers | Name | Description |
---|---|---|
protected static class |
DataSourceBuilder.ReadOnlyDriverManagerDataSource |
Constructor and description |
---|
DataSourceBuilder
(java.lang.ClassLoader classLoader) |
Type Params | Return Type | Name and description |
---|---|---|
|
public javax.sql.DataSource |
build() |
|
public static DataSourceBuilder |
create() |
|
public static DataSourceBuilder |
create(java.lang.ClassLoader classLoader) |
|
public DataSourceBuilder |
driverClassName(java.lang.String driverClassName) |
|
public java.lang.Class<? extends javax.sql.DataSource> |
findType() |
|
public DataSourceBuilder |
password(java.lang.String password) |
|
public DataSourceBuilder |
properties(java.util.Map<java.lang.String, java.lang.String> properties) |
|
public void |
setPooled(boolean pooled) |
|
public void |
setReadOnly(boolean readOnly) |
|
public DataSourceBuilder |
type(java.lang.Class<? extends javax.sql.DataSource> type) |
|
public DataSourceBuilder |
url(java.lang.String url) |
|
public DataSourceBuilder |
username(java.lang.String username) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |