當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。