org.springframework.boot.jdbc

Class DataSourceBuilder<T extends javax.sql.DataSource>

  • java.lang.Object
    • org.springframework.boot.jdbc.DataSourceBuilder<T>
  • Type Parameters:
    T - type of DataSource produced by the builder


    public final class DataSourceBuilder<T extends javax.sql.DataSource>
    extends java.lang.Object
    Convenience class for building a DataSource with common implementations and properties. If HikariCP, Tomcat or Commons DBCP 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.
    Since:
    2.0.0
    • Method Detail

      • create

        public static DataSourceBuilder<?> create(java.lang.ClassLoader classLoader)
      • build

        public T build()
      • type

        public <D extends javax.sql.DataSource> DataSourceBuilder<D> type(java.lang.Class<D> type)
      • driverClassName

        public DataSourceBuilder<T> driverClassName(java.lang.String driverClassName)
      • findType

        public static java.lang.Class<? extends javax.sql.DataSource> findType(java.lang.ClassLoader classLoader)