当前位置: 首页>>代码示例>>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;未经允许,请勿转载。