本文整理匯總了Java中org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java EmbeddedDatabaseBuilder類的具體用法?Java EmbeddedDatabaseBuilder怎麽用?Java EmbeddedDatabaseBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EmbeddedDatabaseBuilder類屬於org.springframework.jdbc.datasource.embedded包,在下文中一共展示了EmbeddedDatabaseBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupEmbeddedDatabase
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
private static void setupEmbeddedDatabase() throws NamingException{
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder
.emptyActivatedContextBuilder();
EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = dbBuilder
.setType(EmbeddedDatabaseType.DERBY)
.setName("usciitg")
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("org/partners/usciitg_prep/terminology/jpa/create-db.sql")
.addScript("org/partners/usciitg_prep/terminology/jpa/insert-data.sql")
.build();
builder.bind(System.getProperty("usciitg.datasource"), db);
}
開發者ID:Discovery-Research-Network-SCCM,項目名稱:FHIR-CQL-ODM-service,代碼行數:17,代碼來源:FhirTerminologyProviderServiceIT.java
示例2: setupEmbeddedDatabase
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
private static void setupEmbeddedDatabase() throws NamingException{
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder
.emptyActivatedContextBuilder();
EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = dbBuilder
.setType(EmbeddedDatabaseType.DERBY)
.setName("usciitg")
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("org/partners/usciitg_prep/terminology/jpa/create-db.sql")
.addScript("org/partners/usciitg_prep/fhir/cql/insert-data.sql")
.build();
builder.bind(System.getProperty("usciitg.datasource"), db);
}
開發者ID:Discovery-Research-Network-SCCM,項目名稱:FHIR-CQL-ODM-service,代碼行數:17,代碼來源:JpaFhirTerminologyProviderIT.java
示例3: setupEmbeddedDatabase
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
private static void setupEmbeddedDatabase() throws NamingException{
SimpleNamingContextBuilder builder = SimpleNamingContextBuilder
.emptyActivatedContextBuilder();
EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = dbBuilder
.setType(EmbeddedDatabaseType.DERBY)
.setName("usciitg")
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("org/partners/usciitg_prep/terminology/jpa/create-db.sql")
.addScript("org/partners/usciitg_prep/fhir/cql/insert-data.sql")
.addScript("org/partners/usciitg_prep/fhir/create-db.sql")
.addScript("org/partners/usciitg_prep/fhir/insert-data.sql")
.build();
builder.bind(System.getProperty("usciitg.datasource"), db);
}
示例4: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(EmbeddedDatabase.class)
public EmbeddedDatabase dataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2) //
.setName("grpcmonitor")//
.addScript("mapper/create-db.sql")//
.build();
return db;
}
示例5: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Bean
public DataSource dataSource() {
EmbeddedDatabase db = new EmbeddedDatabaseBuilder()
.generateUniqueName(true)
.setType(EmbeddedDatabaseType.H2)
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("classpath:me/chanjar/domain/foo-ddl.sql")
.build();
return db;
}
示例6: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Bean(destroyMethod = "shutdown")
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.generateUniqueName(true)
.setType(EmbeddedDatabaseType.H2)
.setScriptEncoding("UTF-8")
.ignoreFailedDrops(true)
.addScript("classpath:me/chanjar/domain/foo-ddl.sql")
.build();
}
示例7: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Bean
DataSource dataSource() {
// @formatter:off
return new EmbeddedDatabaseBuilder()
.generateUniqueName(true)
.setType(EmbeddedDatabaseType.H2)
.addScript("schema-refresh-tokens.sql")
.build();
// @formatter:on
}
示例8: getDataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Override
@Bean(name = "dataSource")
public DataSource getDataSource() {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
EmbeddedDatabase embeddedDb = builder
.setType(EmbeddedDatabaseType.DERBY)
.ignoreFailedDrops(true)
.addScript("sql/create_tables.sql")
.addScript("sql/insert_just_category_data.sql")
.build();
return embeddedDb;
}
示例9: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
/**
* Custom H2 implementation for our {@link EmbeddedDatabase}
* @return
*/
@Bean
public DataSource dataSource() {
// no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
return new EmbeddedDatabaseBuilder()
//Starting embedded database: url='jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
.setName("dataSource")
// Lets not get upset as we are only debugging ;-)
.ignoreFailedDrops(true)
.continueOnError(true)
// DB Details:
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
// Authority tables
.addScript("/database/h2/calendar-authorities.sql")
.addScript("/database/h2/calendar-sha256.sql")
.build();
}
示例10: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
/**
* Custom H2 implementation for our {@link EmbeddedDatabase}
* @return
*/
@Bean
public DataSource dataSource() {
// no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
return new EmbeddedDatabaseBuilder()
//Starting embedded database: url='jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
.setName("dataSource")
// Lets not get upset as we are only debugging ;-)
.ignoreFailedDrops(true)
.continueOnError(true)
// DB Details:
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
.addScript("/database/h2/security-schema.sql")
.addScript("/database/h2/security-users.sql")
.addScript("/database/h2/security-user-authorities.sql")
.build();
}
示例11: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
/**
* Custom H2 implementation for our {@link EmbeddedDatabase}
* @return
*/
@Bean
public DataSource dataSource() {
// no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
return new EmbeddedDatabaseBuilder()
//Starting embedded database: url='jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
.setName("dataSource")
// Lets not get upset as we are only debugging ;-)
.ignoreFailedDrops(true)
.continueOnError(true)
// DB Details:
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
// Authority tables
.addScript("/database/h2/calendar-authorities.sql")
// .addScript("/database/h2/calendar-saltedsha256.sql")
.addScript("/database/h2/calendar-bcrypt.sql")
.build();
}
示例12: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
/**
* Custom H2 implementation for our {@link EmbeddedDatabase}
* @return
*/
@Bean
public DataSource dataSource() {
// no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
return new EmbeddedDatabaseBuilder()
//Starting embedded database: url='jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
.setName("dataSource")
// Lets not get upset as we are only debugging ;-)
.ignoreFailedDrops(true)
.continueOnError(true)
// DB Details:
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
// Security SQL
.addScript("/database/h2/security-schema.sql")
.addScript("/database/h2/security-users.sql")
.addScript("/database/h2/security-groups-schema.sql")
.addScript("/database/h2/security-groups-mappings.sql")
.build();
}
示例13: dataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
/**
* Custom H2 implementation for our {@link EmbeddedDatabase}
* @return
*/
@Bean
public DataSource dataSource() {
// no need shutdown, EmbeddedDatabaseFactoryBean will take care of this
return new EmbeddedDatabaseBuilder()
//Starting embedded database: url='jdbc:h2:mem:dataSource;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false', username='sa'
.setName("dataSource")
// Lets not get upset as we are only debugging ;-)
.ignoreFailedDrops(true)
.continueOnError(true)
// DB Details:
.setType(EmbeddedDatabaseType.H2)
.addScript("/database/h2/calendar-schema.sql")
.addScript("/database/h2/calendar-data.sql")
// Authority tables
.addScript("/database/h2/calendar-authorities.sql")
.build();
}
示例14: h2DataSource
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
private static DataSource h2DataSource() {
synchronized (LOCK) {
if (dataSource == null) {
dataSource = new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.addScript("net/iaeste/iws/persistence/h2/10-base-tables.sql")
.addScript("net/iaeste/iws/persistence/15-base-views.sql")
.addScript("net/iaeste/iws/persistence/19-base-data.sql")
.addScript("net/iaeste/iws/persistence/h2/30-exchange-tables.sql")
.addScript("net/iaeste/iws/persistence/35-exchange-views.sql")
.addScript("net/iaeste/iws/persistence/90-initial-test-data.sql")
.build();
}
return dataSource;
}
}
示例15: dataSourceProd
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; //導入依賴的package包/類
@Bean
public DataSource dataSourceProd() {
String databaseUrl = env.getProperty("database.url");
String databaseUsername = env.getProperty("database.username");
String databasePassword = env.getProperty("database.password");
if(databaseUrl == null || databaseUsername == null || databasePassword == null) {
logger.log(Level.ALL, "Using local H2 database");
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
}
logger.log(Level.ALL, "Using database " + databaseUrl);
return DataSourceBuilder.create()
.url(databaseUrl)
.username(databaseUsername)
.password(databasePassword)
.build();
}