public String determineDriverClassName ( ) { if ( StringUtils . hasText ( this . driverClassName ) ) { Assert . state ( driverClassIsLoadable ( ) , ( ) -> "Cannot load driver class: " + this . driverClassName ) ; return this . driverClassName ; } String driverClassName = null ; if ( StringUtils . hasText ( this . url ) ) { driverClassName = DatabaseDriver . fromJdbcUrl ( this . url ) . getDriverClassName ( ) ; } if ( ! StringUtils . hasText ( driverClassName ) ) { driverClassName = this . embeddedDatabaseConnection . getDriverClassName ( ) ; } if ( ! StringUtils . hasText ( driverClassName ) ) { throw new DataSourceBeanCreationException ( "Failed to determine a suitable driver class" , this , this . embeddedDatabaseConnection ) ; } return driverClassName ; }
Determine the driver to use based on this configuration and the environment .