當前位置: 首頁>>代碼示例>>Java>>正文


Java EmbeddedDatabaseBuilder類代碼示例

本文整理匯總了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);	
}
 
開發者ID:Discovery-Research-Network-SCCM,項目名稱:FHIR-CQL-ODM-service,代碼行數:19,代碼來源:FhirServiceIT.java

示例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;
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:11,代碼來源:MybatisConfiguration.java

示例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;
}
 
開發者ID:chanjarster,項目名稱:spring-test-examples,代碼行數:13,代碼來源:Spring_2_IT_Configuration.java

示例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();
}
 
開發者ID:chanjarster,項目名稱:spring-test-examples,代碼行數:12,代碼來源:Spring_1_IT_Configuration.java

示例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
}
 
開發者ID:vpavic,項目名稱:simple-openid-provider,代碼行數:11,代碼來源:JdbcRefreshTokenStoreIntegrationTests.java

示例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;
}
 
開發者ID:makotogo,項目名稱:odotCore,代碼行數:13,代碼來源:TestCategoryDaoConfiguration.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:24,代碼來源:DataSourceConfig.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:24,代碼來源:DataSourceConfig.java

示例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();
    }
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:25,代碼來源:DataSourceConfig.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:26,代碼來源:DataSourceConfig.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:23,代碼來源:DataSourceConfig.java

示例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;
    }
}
 
開發者ID:IWSDevelopers,項目名稱:iws,代碼行數:18,代碼來源:SpringConfig.java

示例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();

}
 
開發者ID:joeydeluca,項目名稱:apparel,代碼行數:20,代碼來源:DatabaseConfig.java


注:本文中的org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。