Java 类org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType 实例源码

项目:FHIR-CQL-ODM-service    文件:FhirTerminologyProviderServiceIT.java   
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); 
}
项目:FHIR-CQL-ODM-service    文件:JpaFhirTerminologyProviderIT.java   
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); 
}
项目:FHIR-CQL-ODM-service    文件:FhirServiceIT.java   
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); 
}
项目:spring-boot-multidatasource    文件:DataSourceAutoConfiguration.java   
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
        AnnotatedTypeMetadata metadata) {
    ConditionMessage.Builder message = ConditionMessage
            .forCondition("EmbeddedDataSource");
    if (anyMatches(context, metadata, this.pooledCondition)) {
        return ConditionOutcome
                .noMatch(message.foundExactly("supported pooled data source"));
    }
    EmbeddedDatabaseType type = EmbeddedDatabaseConnection
            .get(context.getClassLoader()).getType();
    if (type == null) {
        return ConditionOutcome
                .noMatch(message.didNotFind("embedded database").atAll());
    }
    return ConditionOutcome.match(message.found("embedded database").items(type));
}
项目:saluki    文件:MybatisConfiguration.java   
@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;
}
项目:spring-test-examples    文件:Spring_2_IT_Configuration.java   
@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;
}
项目:spring-test-examples    文件:Spring_1_IT_Configuration.java   
@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();
}
项目:simple-openid-provider    文件:JdbcClientRepositoryIntegrationTests.java   
@Bean
DataSource dataSource() {
    // @formatter:off
    return new EmbeddedDatabaseBuilder()
            .generateUniqueName(true)
            .setType(EmbeddedDatabaseType.H2)
            .addScript("schema-clients.sql")
            .build();
    // @formatter:on
}
项目:simple-openid-provider    文件:JdbcRefreshTokenStoreIntegrationTests.java   
@Bean
DataSource dataSource() {
    // @formatter:off
    return new EmbeddedDatabaseBuilder()
            .generateUniqueName(true)
            .setType(EmbeddedDatabaseType.H2)
            .addScript("schema-refresh-tokens.sql")
            .build();
    // @formatter:on
}
项目:odotCore    文件:TestCategoryDaoConfiguration.java   
@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;
}
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
 * 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();
}
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
 * 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();
}
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
     * 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();
    }
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
 * 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();
}
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
 * 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();
}
项目:Spring-Security-Third-Edition    文件:DataSourceConfig.java   
/**
     * 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();
    }
项目:iws    文件:SpringConfig.java   
private static DataSource hsqldbDataSource() {
    synchronized (LOCK) {
        if (dataSource == null) {
            dataSource = new EmbeddedDatabaseBuilder()
                    .setType(EmbeddedDatabaseType.HSQL)
                    .addScript("net/iaeste/iws/persistence/hsqldb/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/hsqldb/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;
    }
}
项目:iws    文件:SpringConfig.java   
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;
    }
}
项目:Camel    文件:SqlTransactedRouteTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry reg = super.createRegistry();

    db = new EmbeddedDatabaseBuilder()
        .setType(EmbeddedDatabaseType.DERBY).build();
    reg.bind("testdb", db);

    DataSourceTransactionManager txMgr = new DataSourceTransactionManager();
    txMgr.setDataSource(db);
    reg.bind("txManager", txMgr);

    SpringTransactionPolicy txPolicy = new SpringTransactionPolicy();
    txPolicy.setTransactionManager(txMgr);
    txPolicy.setPropagationBehaviorName("PROPAGATION_REQUIRED");
    reg.bind("required", txPolicy);

    return reg;
}
项目:apparel    文件:DatabaseConfig.java   
@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();

}
项目:pndao    文件:MyBatisConfig.java   
@Bean
public DataSource dataSource() {
    //TODO:just for test, replace by your own datasource
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder
            .setType(EmbeddedDatabaseType.H2) //.H2 or .DERBY
            .addScript("db/sql/create-db.sql")
            .addScript("db/sql/insert-data.sql")
            .build();
    return db;
}
项目:spring-reactive-sample    文件:DataSourceConfig.java   
@Bean
public DataSource dataSource() {
    return new EmbeddedDatabaseBuilder()
        .setType(EmbeddedDatabaseType.H2)
        .addScript("schema.sql")
        .build();
}
项目:spring-reactive-sample    文件:DataSourceConfig.java   
@Bean
public DataSource dataSource() {
    return new EmbeddedDatabaseBuilder()
        .setType(EmbeddedDatabaseType.H2)
        .addScript("schema.sql")
        .build();
}
项目:spring-data-examples    文件:CustomerConfig.java   
@Bean
DataSource customerDataSource() {

    return new EmbeddedDatabaseBuilder().//
            setType(EmbeddedDatabaseType.HSQL).//
            setName("customers").//
            build();
}
项目:spring-data-examples    文件:OrderConfig.java   
@Bean
DataSource orderDataSource() {

    return new EmbeddedDatabaseBuilder().//
            setType(EmbeddedDatabaseType.HSQL).//
            setName("orders").//
            build();
}
项目:real-time-risk    文件:H2DataSource.java   
@Bean
public DataSource dataSource() {

    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2)
            .addScript("db/create-db.sql")
            .addScript("db/insert-data.sql").build();
    return db;

}
项目:Your-Microservice    文件:YourMicroserviceEnvironmentConfiguration.java   
/**
 * DataSource
 * @return DataSource
 */
@Bean
@Primary
@ConfigurationProperties(prefix="datasource.idp")
public DataSource dataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    return builder.setType(EmbeddedDatabaseType.H2).build();
}
项目:spring-batch-support    文件:DataSourceConfig.java   
@Bean
public DataSource dataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    return builder.setType(EmbeddedDatabaseType.H2)
                  .setName("namicsBatch")
                  .addScript("classpath:org/springframework/batch/core/schema-h2.sql")
                  .build();
}
项目:Using-Spring-Oauth2-to-secure-REST    文件:Oauth2Application.java   
@Bean @Qualifier("mainDataSource")
public DataSource dataSource(){
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder
            .setType(EmbeddedDatabaseType.H2)
            .build();
    return db;
}
项目:Oauth2-Stateless-Authentication-with-Spring-and-JWT-Token    文件:DemoOauth2Application.java   
@Bean @Qualifier("mainDataSource")
public DataSource dataSource(){
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder
            .setType(EmbeddedDatabaseType.H2)
            .build();
    return db;
}
项目:spring-configuration-support    文件:SampleConfig.java   
@Bean
public DataSource dataSource() {
    return new EmbeddedDatabaseBuilder()
            .setType(EmbeddedDatabaseType.H2)
            .generateUniqueName(true)
            .ignoreFailedDrops(true)
            .setScriptEncoding("UTF-8")
            .addScripts("classpath:/db/schema.sql", "classpath:/db/data.sql")
            .build();
}
项目:spring-i18n-support    文件:WebappConfig.java   
@Bean
public DataSource dataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder.setType(EmbeddedDatabaseType.H2)
                                 .addScript("/jdbc/schema.sql")
                                 .addScript("/jdbc/data.sql")
                                 .build();
    return db;
}
项目:odotCore    文件:TestConfiguration.java   
@Override
@Bean(name = "dataSource")
public DataSource getDataSource() {
  EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
  EmbeddedDatabase embeddedDb = builder
      .setType(EmbeddedDatabaseType.DERBY)
      .ignoreFailedDrops(true)
      // .addScript("sql/drop_tables.sql")
      .addScript("sql/create_tables.sql")
      .addScript("sql/insert_data.sql")
      .build();
  return embeddedDb;
}
项目:odotCore    文件:TestConfigurationEmptyDb.java   
@Override
@Bean(name = "dataSource")
public DataSource getDataSource() {
  EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
  EmbeddedDatabase embeddedDb = builder
      .setType(EmbeddedDatabaseType.DERBY)
      .ignoreFailedDrops(true)
      .addScript("sql/create_tables.sql")
      // NO DATA
      .build();
  return embeddedDb;
}
项目:camel-springboot    文件:StoredProcTest.java   
@Bean(value = "cityInfoDS")
@Primary
public DataSource createCityInfoDS(){
    return new EmbeddedDatabaseBuilder()
            .setType(EmbeddedDatabaseType.DERBY)
            .setName("CityInfoDatabase")
            .addScript("sql/GETZIPS.sql")
            .addScript("sql/StoredProcTest.sql")
            .build();
}
项目:siga    文件:SpringDBConfig.java   
@Bean
public DataSource getDataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder.setName("testdb").setType(EmbeddedDatabaseType.HSQL)
            .addScript("db/sql/create-db.sql").addScript("db/sql/insert-data.sql").build();
    return db;
}
项目:holon-datastore-jpa    文件:TestMultiTenant.java   
@Bean
public TenantDataSourceProvider tenantDataSourceProvider() {
    return tenantId -> {
        if (tenantId == null) {
            // for hibernate startup
            return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).setName("startup")
                    .addScript("scripts/test-db-schema.sql").build();
        }
        return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).setName(tenantId)
                .addScript("scripts/test-db-schema.sql").addScript("scripts/test-db-data-" + tenantId + ".sql")
                .build();
    };
}
项目:holon-datastore-jpa    文件:TestMultiTenancy.java   
@Bean(destroyMethod = "close")
public MultiTenantDataSource dataSource() {
    return MultiTenantDataSource.builder().resolver(() -> Optional.ofNullable(TENANT.get()))
            .provider(tenantId -> {
                if (tenantId == null) {
                    // for hibernate startup
                    return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).setName("startup")
                            .addScript("test-db-schema.sql").build();
                }
                return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).setName(tenantId)
                        .addScript("test-db-schema.sql").addScript("test-db-data-" + tenantId + ".sql").build();
            }).build();
}
项目:spring-boot-starter-quartz    文件:TestContextConfiguration7.java   
@Bean("dataSource")
public DataSource dataSource() {

    return new EmbeddedDatabaseBuilder().generateUniqueName(true)
            .setType(EmbeddedDatabaseType.H2)
            .setScriptEncoding("UTF-8")
            .ignoreFailedDrops(true).build();
}
项目:spring-boot-starter-quartz    文件:TestContextConfiguration7.java   
@Bean("otherDataSource")
@Primary
public DataSource otherDataSource() {

    return new EmbeddedDatabaseBuilder().generateUniqueName(true)
            .setType(EmbeddedDatabaseType.H2)
            .setScriptEncoding("UTF-8")
            .ignoreFailedDrops(true).build();
}