当前位置: 首页>>代码示例>>Java>>正文


Java EmbeddedDatabase类代码示例

本文整理汇总了Java中org.springframework.jdbc.datasource.embedded.EmbeddedDatabase的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedDatabase类的具体用法?Java EmbeddedDatabase怎么用?Java EmbeddedDatabase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmbeddedDatabase类属于org.springframework.jdbc.datasource.embedded包,在下文中一共展示了EmbeddedDatabase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupEmbeddedDatabase

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的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.EmbeddedDatabase; //导入依赖的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.EmbeddedDatabase; //导入依赖的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.EmbeddedDatabase; //导入依赖的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.EmbeddedDatabase; //导入依赖的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: getDataSource

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的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

示例7: main

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
public static void main(final String[] args) throws SQLException {
    LOGGER.info("===========================================================");
    // r�cup�ration du contexte via les annotations � partir d'un package
    ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfiguration.class);
    LOGGER.info("===========================================================");
    // notre contexte est charg�
    LOGGER.info("context is loaded : {}", context);

    LOGGER.info("-----------------------------------------------------------");

    EmbeddedDatabase dataSource = context.getBean(EmbeddedDatabase.class);

    LOGGER.info("Datasource : {}, connection : {}", dataSource, dataSource.getConnection().isClosed());


    // fermeture de la base embarqu�e
    dataSource.shutdown();
}
 
开发者ID:Eulbobo,项目名称:java-samples,代码行数:19,代码来源:Application.java

示例8: noTable

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@Test
public void noTable() throws ClassNotFoundException, SQLException, JAXBException, IOException {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase embeddedDatabase = builder.setType(EmbeddedDatabaseType.H2).build();

    Metadata meta = extractor.extract(embeddedDatabase.getConnection());

    assertThat(countTables(meta)).isZero();
    assertThat(countColumns(meta)).isZero();
    assertThat(countPrimaryKeys(meta)).isZero();
    assertThat(countImportedKeys(meta)).isZero();
    assertThat(countIndexes(meta)).isZero();
    assertThat(countEnums(meta)).isZero();

    embeddedDatabase.shutdown();
}
 
开发者ID:jaxio,项目名称:celerio,代码行数:17,代码来源:MetaDataExtractorTest.java

示例9: outputIsSameAsInput

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@Test
public void outputIsSameAsInput() throws ClassNotFoundException, SQLException, XmlMappingException, IOException {
    EmbeddedDatabase embeddedDatabase = createMinimalEmbeddedDatabase(ALL_RELATIONS_SCRIPT);

    Metadata meta = extractor.extract(embeddedDatabase.getConnection());


    assertThat(countTables(meta)).isEqualTo(18);
    assertThat(countColumns(meta)).isEqualTo(49);
    assertThat(countPrimaryKeys(meta)).isEqualTo(18);
    assertThat(countIndexes(meta)).isEqualTo(21);
    assertThat(countEnums(meta)).isEqualTo(3);

    File tempFile = File.createTempFile(getClass().getName(), ".xml");
    tempFile.deleteOnExit();
    loader.write(meta, tempFile);

    Metadata loadedMeta = loader.load(tempFile);
    assertThat(countTables(meta)).isEqualTo(countTables(loadedMeta));
    assertThat(countColumns(meta)).isEqualTo(countColumns(loadedMeta));
    assertThat(countPrimaryKeys(meta)).isEqualTo(countPrimaryKeys(loadedMeta));
    assertThat(countIndexes(meta)).isEqualTo(countIndexes(loadedMeta));
    assertThat(countEnums(meta)).isEqualTo(countEnums(loadedMeta));

    embeddedDatabase.shutdown();
}
 
开发者ID:jaxio,项目名称:celerio,代码行数:27,代码来源:MetaDataExtractorTest.java

示例10: testConfigurationHotReloading

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@Test
public void testConfigurationHotReloading() throws Exception {
    //given
    EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setName("test").addScript("database.sql").build();
    System.setProperty("sp", "foo");
    HotReloadableConfig config = new HotReloadableConfig();

    //when
    propertiesInjector.injectProperties(config);

    //then
    assertThat(config.getSystemProperty()).isEqualTo("foo");
    assertThat(config.getName()).isEqualTo("Foo");

    // Properties changes should be reloaded
    System.setProperty("sp","bar");
    new JdbcTemplate(database).update("update ApplicationProperties set value = ? where key = ?", "Bar", "name");
    sleep(2 * 1000);
    assertThat(config.getSystemProperty()).isEqualTo("bar");
    assertThat(config.getName()).isEqualTo("Bar");
    database.shutdown();
}
 
开发者ID:j-easy,项目名称:easy-props,代码行数:23,代码来源:PropertiesInjectorImplTest.java

示例11: dataSource

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@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;
}
 
开发者ID:frankelau,项目名称:pndao,代码行数:12,代码来源:MyBatisConfig.java

示例12: dataSource

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@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;

}
 
开发者ID:alexcwyu,项目名称:real-time-risk,代码行数:11,代码来源:H2DataSource.java

示例13: dataSource

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@Bean @Qualifier("mainDataSource")
public DataSource dataSource(){
	EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
	EmbeddedDatabase db = builder
			.setType(EmbeddedDatabaseType.H2)
			.build();
	return db;
}
 
开发者ID:tinmegali,项目名称:Using-Spring-Oauth2-to-secure-REST,代码行数:9,代码来源:Oauth2Application.java

示例14: dataSource

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@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;
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:10,代码来源:WebappConfig.java

示例15: sqlSessionFactoryBean

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入依赖的package包/类
@Bean(name = "sqlSessionFactory")
public SqlSessionFactory sqlSessionFactoryBean(EmbeddedDatabase dataSource) {
    SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
    bean.setDataSource(dataSource);
    bean.setTypeAliasesPackage("com.quancheng.saluki.domain");
    ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    try {
        bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
        return bean.getObject();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:venus-boot,项目名称:saluki,代码行数:14,代码来源:MybatisConfiguration.java


注:本文中的org.springframework.jdbc.datasource.embedded.EmbeddedDatabase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。