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


Java ResourceDatabasePopulator.setIgnoreFailedDrops方法代码示例

本文整理汇总了Java中org.springframework.jdbc.datasource.init.ResourceDatabasePopulator.setIgnoreFailedDrops方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceDatabasePopulator.setIgnoreFailedDrops方法的具体用法?Java ResourceDatabasePopulator.setIgnoreFailedDrops怎么用?Java ResourceDatabasePopulator.setIgnoreFailedDrops使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jdbc.datasource.init.ResourceDatabasePopulator的用法示例。


在下文中一共展示了ResourceDatabasePopulator.setIgnoreFailedDrops方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nonBootDataSourceInitializer

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
@ConditionalOnProperty("pgcopy.initialize")
@Bean
public DataSourceInitializer nonBootDataSourceInitializer(DataSource dataSource, ResourceLoader resourceLoader) {
	DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
	dataSourceInitializer.setDataSource(dataSource);
	ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
	databasePopulator.setIgnoreFailedDrops(true);
	dataSourceInitializer.setDatabasePopulator(databasePopulator);
	if ("true".equals(properties.getInitialize())) {
		databasePopulator.addScript(new DefaultInitializationScriptResource(properties.getTableName(),
				properties.getColumns()));
	} else {
		databasePopulator.addScript(resourceLoader.getResource(properties.getInitialize()));
	}
	return dataSourceInitializer;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:jdbc,代码行数:17,代码来源:PgcopySinkConfiguration.java

示例2: nonBootDataSourceInitializer

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
@ConditionalOnProperty("jdbc.initialize")
@Bean
public DataSourceInitializer nonBootDataSourceInitializer(DataSource dataSource, ResourceLoader resourceLoader) {
	DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
	dataSourceInitializer.setDataSource(dataSource);
	ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
	databasePopulator.setIgnoreFailedDrops(true);
	dataSourceInitializer.setDatabasePopulator(databasePopulator);
	if ("true".equals(properties.getInitialize())) {
		databasePopulator.addScript(new DefaultInitializationScriptResource(properties.getTableName(),
				properties.getColumnsMap().keySet()));
	}
	else {
		databasePopulator.addScript(resourceLoader.getResource(properties.getInitialize()));
	}
	return dataSourceInitializer;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:jdbc,代码行数:18,代码来源:JdbcSinkConfiguration.java

示例3: executeSql

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
protected void executeSql(String path) {
    logger.info("executeSql : " + path);

    Resource resource = new ClassPathResource(path, getClass());
    ResourceDatabasePopulator rdp = new ResourceDatabasePopulator();
    rdp.addScript(resource);
    rdp.setSqlScriptEncoding("UTF-8");
    rdp.setIgnoreFailedDrops(true);
    rdp.setContinueOnError(false);

    try (Connection conn = DataSourceUtils.getConnection(dataSource)) {
        rdp.populate(conn);
    }
    catch (Exception e) {
        throw new IllegalStateException("executeSql failed, path=" + path, e);
    }
}
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:18,代码来源:SpringTestBase.java

示例4: databasePopulator

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
@Bean
public DatabasePopulator databasePopulator(DataSource dataSource) {
    ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
    populator.setContinueOnError(true);
    populator.setIgnoreFailedDrops(true);
    populator.addScripts(new ClassPathResource("/db/h2schema.sql"),
            new ClassPathResource("/db/h2data.sql"));
    try {
        populator.populate(dataSource.getConnection());
    } catch (SQLException ignored) {
    }
    return populator;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:14,代码来源:H2Config.java

示例5: databasePopulator

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
private DatabasePopulator databasePopulator() {
	final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
	populator.setIgnoreFailedDrops(true);
	populator.setContinueOnError(true);
	populator.addScript(dropScript);
	populator.addScript(schemaScript);
	return populator;
}
 
开发者ID:vadivelmurugesan,项目名称:spring-batch-admin,代码行数:9,代码来源:DataSourceConfig.java

示例6: nonBootDataSourceInitializer

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
@ConditionalOnProperty("jdbc.initialize")
@Bean
public DataSourceInitializer nonBootDataSourceInitializer(DataSource dataSource, ResourceLoader resourceLoader) {
	DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
	dataSourceInitializer.setDataSource(dataSource);
	ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
	databasePopulator.setIgnoreFailedDrops(true);
	dataSourceInitializer.setDatabasePopulator(databasePopulator);
	if ("true".equals(properties.getInitialize())) {
		databasePopulator.addScript(new DefaultInitializationScriptResource(properties));
	} else {
		databasePopulator.addScript(resourceLoader.getResource(properties.getInitialize()));
	}
	return dataSourceInitializer;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:16,代码来源:JdbcSinkConfiguration.java

示例7: createResourceDatabasePopulator

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
protected ResourceDatabasePopulator createResourceDatabasePopulator() {
    ResourceDatabasePopulator resourceDatabasePopulator = new ResourceDatabasePopulator();
    resourceDatabasePopulator.setCommentPrefix(getCommentPrefix());
    resourceDatabasePopulator.setContinueOnError(isContinueOnError());
    resourceDatabasePopulator.setIgnoreFailedDrops(isIgnoreFailedDrops());
    resourceDatabasePopulator.setSqlScriptEncoding(getSqlScriptEncoding());
    return resourceDatabasePopulator;
}
 
开发者ID:vladmihalcea,项目名称:vladmihalcea.wordpress.com,代码行数:9,代码来源:DatabaseScriptLifecycleHandler.java

示例8: prepareDatabase

import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; //导入方法依赖的package包/类
private void prepareDatabase() {
  final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
  populator.addScript(new ClassPathResource("prepare-database.sql"));
  populator.setIgnoreFailedDrops(true);

  TransactionTemplate trxTemplate = new TransactionTemplate(transactionManager());
  trxTemplate.execute(new TransactionCallback<Void>() {

    @Override
    public Void doInTransaction(TransactionStatus status) {
      DatabasePopulatorUtils.execute(populator, DatabaseConfiguration.this.dataSource);
      return null;
    }
  });
}
 
开发者ID:ferstl,项目名称:spring-jdbc-oracle,代码行数:16,代码来源:DatabaseConfiguration.java


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