本文整理汇总了Java中liquibase.integration.spring.SpringLiquibase.afterPropertiesSet方法的典型用法代码示例。如果您正苦于以下问题:Java SpringLiquibase.afterPropertiesSet方法的具体用法?Java SpringLiquibase.afterPropertiesSet怎么用?Java SpringLiquibase.afterPropertiesSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liquibase.integration.spring.SpringLiquibase
的用法示例。
在下文中一共展示了SpringLiquibase.afterPropertiesSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: runOnAllSchemasXm
import liquibase.integration.spring.SpringLiquibase; //导入方法依赖的package包/类
private void runOnAllSchemasXm() throws LiquibaseException {
for (String schema : getSchemas()) {
if (schema.equals("default")) {
schema = null;
}
log.info("Initializing Liquibase for schema {}", schema);
try {
SpringLiquibase liquibase = getXmSpringLiquibase(getDataSource());
liquibase.setDefaultSchema(schema);
liquibase.afterPropertiesSet();
log.info("Liquibase run for schema {}", schema);
} catch (Exception e) {
log.error("Failed to initialize Liquibase for schema {}", schema, e);
}
}
}
示例3: 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);
}
}
示例4: 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);
}
}