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


Java SpringLiquibase.setDataSource方法代码示例

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


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

示例1: migrate

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
/**
 * Migrate database with liquibase.
 * @param tenantKey the tenant key
 */
@SneakyThrows
public void migrate(String tenantKey) {
    final StopWatch stopWatch = createStarted();
    try {
        log.info("START - SETUP:CreateTenant:liquibase tenantKey: {}", tenantKey);
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setResourceLoader(resourceLoader);
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog(CHANGE_LOG_PATH);
        liquibase.setContexts(liquibaseProperties.getContexts());
        liquibase.setDefaultSchema(tenantKey);
        liquibase.setDropFirst(liquibaseProperties.isDropFirst());
        liquibase.setChangeLogParameters(DatabaseUtil.defaultParams(tenantKey));
        liquibase.setShouldRun(true);
        liquibase.afterPropertiesSet();
        log.info("STOP  - SETUP:CreateTenant:liquibase tenantKey: {}, result: OK, time = {} ms", tenantKey,
            stopWatch.getTime());
    } catch (Exception e) {
        log.info("STOP  - SETUP:CreateTenant:liquibase tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenantKey, e.getMessage(), stopWatch.getTime());
        throw e;
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:28,代码来源:TenantDatabaseService.java

示例2: create

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
/**
 * Create database schema for tenant.
 *
 * @param tenant - the tenant
 */
public void create(Tenant tenant) {
    StopWatch stopWatch = createStarted();
    log.info("START - SETUP:CreateTenant:schema tenantKey={}", tenant.getTenantKey());
    DatabaseUtil.createSchema(dataSource, tenant.getTenantKey());
    log.info("STOP - SETUP:CreateTenant:schema tenantKey={}, time={}ms", tenant.getTenantKey(),
        stopWatch.getTime());
    try {
        stopWatch.reset();
        stopWatch.start();
        log.info("START - SETUP:CreateTenant:liquibase tenantKey={}", tenant.getTenantKey());
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setResourceLoader(resourceLoader);
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog(CHANGE_LOG_PATH);
        liquibase.setContexts(liquibaseProperties.getContexts());
        liquibase.setDefaultSchema(tenant.getTenantKey());
        liquibase.setDropFirst(liquibaseProperties.isDropFirst());
        liquibase.setShouldRun(true);
        liquibase.afterPropertiesSet();
        log.info("STOP - SETUP:CreateTenant:liquibase tenantKey={}, time={}ms", tenant.getTenantKey(),
            stopWatch.getTime());
    } catch (LiquibaseException e) {
        throw new RuntimeException("Can not migrate database for creation tenant " + tenant.getTenantKey(), e);
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:31,代码来源:TenantDatabaseService.java

示例3: liquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
@Bean
public SpringLiquibase liquibase() {
    myLogger.info("Initializing Liquibase.");
    syncIfNecessary();

    // If the database is out of date, this will update it to the latest
    // schema.
    SpringLiquibase lb = new SpringLiquibase();
    lb.setChangeLog("classpath:db/changelog/db.changelog-master.yaml");
    lb.setDataSource(myDataSource);
    Map<String, String> params = Maps.newHashMap();
    params.put("verbose", "true");
    lb.setChangeLogParameters(params);
    lb.setShouldRun(true);

    return lb;
}
 
开发者ID:swri-robotics,项目名称:bag-database,代码行数:18,代码来源:LiquibaseConfig.java

示例4: getXmSpringLiquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
private SpringLiquibase getXmSpringLiquibase(DataSource dataSource) {
    SpringLiquibase liquibase = new SpringLiquibase();
    liquibase.setChangeLog(getChangeLog());
    liquibase.setChangeLogParameters(getParameters());
    liquibase.setContexts(getContexts());
    liquibase.setLabels(getLabels());
    liquibase.setDropFirst(isDropFirst());
    liquibase.setShouldRun(isShouldRun());
    liquibase.setRollbackFile(getRollbackFile());
    liquibase.setResourceLoader(getResourceLoader());
    liquibase.setDataSource(dataSource);
    liquibase.setDefaultSchema(getDefaultSchema());
    return liquibase;
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:15,代码来源:XmMultiTenantSpringLiquibase.java

示例5: create

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
/**
 * Create database schema for tenant.
 *
 * @param tenant - the tenant
 */
public void create(Tenant tenant) {
    final StopWatch stopWatch = createStarted();
    final String tenantKey = tenant.getTenantKey();

    log.info("START - SETUP:CreateTenant:schema tenantKey: {}", tenantKey);
    DatabaseUtil.createSchema(dataSource, tenantKey);
    log.info("STOP  - SETUP:CreateTenant:schema tenantKey: {}, time = {} ms", tenantKey,
        stopWatch.getTime());
    try {
        stopWatch.reset();
        stopWatch.start();
        log.info("START - SETUP:CreateTenant:liquibase tenantKey: {}", tenantKey);
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setResourceLoader(resourceLoader);
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog(CHANGE_LOG_PATH);
        liquibase.setContexts(liquibaseProperties.getContexts());
        liquibase.setDefaultSchema(tenantKey);
        liquibase.setDropFirst(liquibaseProperties.isDropFirst());
        liquibase.setShouldRun(true);
        liquibase.afterPropertiesSet();
        log.info("STOP  - SETUP:CreateTenant:liquibase tenantKey: {}, result: OK, time = {} ms", tenantKey,
            stopWatch.getTime());
    } catch (LiquibaseException e) {
        log.info("STOP  - SETUP:CreateTenant:liquibase tenantKey: {}, result: FAIL, error: {}, time = {} ms",
            tenantKey, e.getMessage(), stopWatch.getTime());
        throw new RuntimeException("Can not migrate database for creation tenant " + tenantKey, e);
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:35,代码来源:TenantDatabaseService.java

示例6: getSpringLiquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
private SpringLiquibase getSpringLiquibase() {
    final SpringLiquibase liquibase = new SpringLiquibase();
    liquibase.setChangeLog(LIQUIBASE_CHANGELOG_LOCATION);
    liquibase.setResourceLoader(resourceLoader);
    liquibase.setDataSource(dataSource);
    return liquibase;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:8,代码来源:LiquibaseConfig.java

示例7: liquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
@Bean
public SpringLiquibase liquibase(DataSource dataSource) {
    SpringLiquibase springLiquibase = new SpringLiquibase();
    springLiquibase.setDataSource(dataSource);
    springLiquibase.setChangeLog("classpath:db-changelog.main.xml");
    return springLiquibase;

}
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:9,代码来源:Application.java

示例8: liquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
@Bean
SpringLiquibase liquibase() {
    SpringLiquibase springLiquibase = new SpringLiquibase();
    springLiquibase.setDataSource(dataSource());
    springLiquibase.setChangeLog("classpath:/META-INF/database/score.changes.xml");
    return springLiquibase;
}
 
开发者ID:CloudSlang,项目名称:score,代码行数:8,代码来源:ScoreDefaultDatasourceContext.java

示例9: getSpringLiquibase

import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
@Bean
public SpringLiquibase getSpringLiquibase(final DataSource dataSource) {
	final SpringLiquibase liquibase = new SpringLiquibase();
	liquibase.setDataSource(dataSource);
	liquibase.setChangeLog(TestConstants.LIQUIBASE_FILE);
	// liquibase.setContexts("development, production");
	return liquibase;
}
 
开发者ID:ufoscout,项目名称:jporm,代码行数:9,代码来源:JpoCommonsCoreTestConfig.java


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