Example usage for org.springframework.boot.jdbc DataSourceBuilder create

List of usage examples for org.springframework.boot.jdbc DataSourceBuilder create

Introduction

In this page you can find the example usage for org.springframework.boot.jdbc DataSourceBuilder create.

Prototype

public static DataSourceBuilder<?> create(ClassLoader classLoader) 

Source Link

Usage

From source file:org.springframework.boot.jdbc.DataSourceBuilderTests.java

@Test
public void defaultToTomcatIfHikariIsNotAvailable() {
    this.dataSource = DataSourceBuilder.create(new HidePackagesClassLoader("com.zaxxer.hikari"))
            .url("jdbc:h2:test").build();
    assertThat(this.dataSource).isInstanceOf(org.apache.tomcat.jdbc.pool.DataSource.class);
}

From source file:org.springframework.boot.jdbc.DataSourceBuilderTests.java

@Test
public void defaultToCommonsDbcp2AsLastResort() {
    this.dataSource = DataSourceBuilder
            .create(new HidePackagesClassLoader("com.zaxxer.hikari", "org.apache.tomcat.jdbc.pool"))
            .url("jdbc:h2:test").build();
    assertThat(this.dataSource).isInstanceOf(BasicDataSource.class);
}