本文整理汇总了Java中org.springframework.boot.jdbc.DatabaseDriver类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseDriver类的具体用法?Java DatabaseDriver怎么用?Java DatabaseDriver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseDriver类属于org.springframework.boot.jdbc包,在下文中一共展示了DatabaseDriver类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validate
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
@Override
public void validate(UIValidationContext validator)
{
final DatabaseType database = dbType.getValue();
final DatabaseDriver driver = DatabaseDriver.fromProductName(database.name());
if (driver.equals(DatabaseDriver.UNKNOWN))
{
// Spring Boot doesn't know about this DB
validator.addValidationError(dbType, "Spring Boot doesn't know about DB '" + dbType.getName() + "'");
}
if (isNotEmbeddedDB(database) && !databaseURL.hasValue() && !dataSourceName.hasValue())
{
validator.addValidationError(dataSourceName, "Either DataSource name or database URL is required");
validator.addValidationError(databaseURL, "Either DataSource name or database URL is required");
}
}
开发者ID:forge,项目名称:springboot-addon,代码行数:18,代码来源:SpringBootJPASetupWizard.java
示例2: createXaDataSource
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
private XADataSource createXaDataSource(DataSourceProperties properties)
throws ClassNotFoundException, LinkageError {
String className = Optional
.ofNullable(properties.getXa())
.map(Xa::getDataSourceClassName)
.map(String::trim)
.map(Strings::emptyToNull)
.orElseGet(() -> DatabaseDriver
.fromJdbcUrl(properties.determineUrl())
.getXaDataSourceClassName());
Assert.state(StringUtils.hasLength(className),
"No XA DataSource class name specified or inferred");
XADataSource dataSource = createXaDataSourceInstance(className);
bindXaProperties(dataSource, properties);
return dataSource;
}
开发者ID:indigo-dc,项目名称:orchestrator,代码行数:17,代码来源:DatasourceConfig.java
示例3: createTomcatDataSource
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
protected org.apache.tomcat.jdbc.pool.DataSource createTomcatDataSource(DataSourceProperties properties) {
org.apache.tomcat.jdbc.pool.DataSource dataSource = createDataSource(
properties, org.apache.tomcat.jdbc.pool.DataSource.class);
DatabaseDriver databaseDriver = DatabaseDriver
.fromJdbcUrl(properties.determineUrl());
String validationQuery = databaseDriver.getValidationQuery();
if (validationQuery != null) {
dataSource.setTestOnBorrow(true);
dataSource.setValidationQuery(validationQuery);
}
return dataSource;
}
开发者ID:muxiangqiu,项目名称:spring-boot-multidatasource,代码行数:13,代码来源:DataSourceConfiguration.java
示例4: getValidationQuery
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
protected String getValidationQuery(String product) {
String query = this.query;
if (!StringUtils.hasText(query)) {
DatabaseDriver specific = DatabaseDriver.fromProductName(product);
query = specific.getValidationQuery();
}
if (!StringUtils.hasText(query)) {
query = DEFAULT_QUERY;
}
return query;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:DataSourceHealthIndicator.java
示例5: createXaDataSource
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
private XADataSource createXaDataSource() {
String className = this.properties.getXa().getDataSourceClassName();
if (!StringUtils.hasLength(className)) {
className = DatabaseDriver.fromJdbcUrl(this.properties.determineUrl())
.getXaDataSourceClassName();
}
Assert.state(StringUtils.hasLength(className),
"No XA DataSource class name specified");
XADataSource dataSource = createXaDataSourceInstance(className);
bindXaProperties(dataSource, this.properties);
return dataSource;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:XADataSourceAutoConfiguration.java
示例6: maybeGetDriverClassName
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
private void maybeGetDriverClassName() {
if (!this.properties.containsKey("driverClassName")
&& this.properties.containsKey("url")) {
String url = this.properties.get("url");
String driverClass = DatabaseDriver.fromJdbcUrl(url).getDriverClassName();
this.properties.put("driverClassName", driverClass);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:DataSourceBuilder.java
示例7: tomcatValidatesConnectionByDefault
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
@Test
public void tomcatValidatesConnectionByDefault() {
org.apache.tomcat.jdbc.pool.DataSource dataSource = autoConfigureDataSource(
org.apache.tomcat.jdbc.pool.DataSource.class);
assertThat(dataSource.isTestOnBorrow()).isTrue();
assertThat(dataSource.getValidationQuery())
.isEqualTo(DatabaseDriver.HSQLDB.getValidationQuery());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:DataSourceAutoConfigurationTests.java
示例8: commonsDbcpValidatesConnectionByDefault
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
@Test
public void commonsDbcpValidatesConnectionByDefault() {
BasicDataSource dataSource = autoConfigureDataSource(BasicDataSource.class,
"org.apache.tomcat", "com.zaxxer.hikari");
assertThat(dataSource.getTestOnBorrow()).isTrue();
assertThat(dataSource.getValidationQuery())
.isEqualTo(DatabaseDriver.HSQLDB.getValidationQuery());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:DataSourceAutoConfigurationTests.java
示例9: driverClassName
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
private String driverClassName() {
if (StringUtils.hasText(driverClassName)) {
return driverClassName;
}
return DatabaseDriver.fromJdbcUrl(url).getDriverClassName();
}
开发者ID:jkazama,项目名称:sample-boot-micro,代码行数:7,代码来源:OrmDataSourceProperties.java
示例10: validationQuery
import org.springframework.boot.jdbc.DatabaseDriver; //导入依赖的package包/类
private String validationQuery() {
if (StringUtils.hasText(validationQuery)) {
return validationQuery;
}
return DatabaseDriver.fromJdbcUrl(url).getValidationQuery();
}
开发者ID:jkazama,项目名称:sample-boot-micro,代码行数:7,代码来源:OrmDataSourceProperties.java
注:本文中的org.springframework.boot.jdbc.DatabaseDriver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论