本文整理汇总了Java中org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder.driverClassName方法的典型用法代码示例。如果您正苦于以下问题:Java DataSourceBuilder.driverClassName方法的具体用法?Java DataSourceBuilder.driverClassName怎么用?Java DataSourceBuilder.driverClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder
的用法示例。
在下文中一共展示了DataSourceBuilder.driverClassName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dataSource
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; //导入方法依赖的package包/类
@Primary
@Bean(destroyMethod = "close")
public DataSource dataSource() {
final EmbeddedMysql embeddedMysql = embeddedMysql(); // make sure embeddedMySql is started.
Map<String, String> params = ImmutableMap.<String, String>builder()
.put("profileSQL", String.valueOf(false))
.put("generateSimpleParameterMetadata", String.valueOf(true))
.build();
final String url = String.format("jdbc:mysql://localhost:%d/%s?%s",
embeddedMysql.getConfig().getPort(),
SCHEMA_NAME,
Joiner.on("&").withKeyValueSeparator("=").join(params));
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.username(embeddedMysql.getConfig().getUsername());
dataSourceBuilder.password(embeddedMysql.getConfig().getPassword());
dataSourceBuilder.driverClassName(com.mysql.jdbc.Driver.class.getName());
dataSourceBuilder.url(url);
return dataSourceBuilder.build();
}
示例2: dataSource
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; //导入方法依赖的package包/类
@Bean
@Primary
public DataSource dataSource() {
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName(org.sqlite.JDBC.class.getName());
dataSourceBuilder.url("jdbc:sqlite:~amv-access-test.db?journal_mode=wal");
return dataSourceBuilder.build();
}
示例3: dataSource
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; //导入方法依赖的package包/类
@Bean
@Primary
public DataSource dataSource() {
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName(org.sqlite.JDBC.class.getName());
dataSourceBuilder.url("jdbc:sqlite:~amv-access-swagger-docs.db?journal_mode=wal");
return dataSourceBuilder.build();
}
示例4: dataSource
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; //导入方法依赖的package包/类
@Bean
public DataSource dataSource() {
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
dataSourceBuilder.driverClassName(driverClassName);
dataSourceBuilder.url(url);
dataSourceBuilder.type(HikariDataSource.class);
return dataSourceBuilder.build();
}
示例5: buildDataSourceDev
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; //导入方法依赖的package包/类
@Bean
@Qualifier("dataSource")
public DataSource buildDataSourceDev() {
DataSourceBuilder dsb = DataSourceBuilder.create();
dsb.driverClassName(driver);
dsb.url(url);
dsb.username(username);
dsb.password(password);
return dsb.build();
}