Package tech.jhipster.config.liquibase
Class AsyncSpringLiquibase
- java.lang.Object
-
- liquibase.integration.spring.SpringLiquibase
-
- org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase
-
- tech.jhipster.config.liquibase.AsyncSpringLiquibase
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ResourceLoaderAware
public class AsyncSpringLiquibase extends org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase
Specific liquibase.integration.spring.SpringLiquibase that will update the database asynchronously and close DataSource if necessary.By default, this asynchronous version only works when using the "dev" profile.
The standard liquibase.integration.spring.SpringLiquibase starts Liquibase in the current thread:
- This is needed if you want to do some database requests at startup
- This ensure that the database is ready when the application starts
- On a recent MacBook Pro, start-up time is down from 14 seconds to 8 seconds
- In production, this can help your application run on platforms like Heroku, where it must start/restart very quickly
-
-
Field Summary
Fields Modifier and Type Field Description static String
DISABLED_MESSAGE
ConstantDISABLED_MESSAGE="Liquibase is disabled"
static String
EXCEPTION_MESSAGE
ConstantEXCEPTION_MESSAGE="Liquibase could not start correctly, yo"{trunked}
static String
SLOWNESS_MESSAGE
ConstantSLOWNESS_MESSAGE="Warning, Liquibase took more than {} se"{trunked}
static long
SLOWNESS_THRESHOLD
ConstantSLOWNESS_THRESHOLD=5
static String
STARTED_MESSAGE
ConstantSTARTED_MESSAGE="Liquibase has updated your database in "{trunked}
static String
STARTING_ASYNC_MESSAGE
ConstantSTARTING_ASYNC_MESSAGE="Starting Liquibase asynchronously, your"{trunked}
static String
STARTING_SYNC_MESSAGE
ConstantSTARTING_SYNC_MESSAGE="Starting Liquibase synchronously"
-
Fields inherited from class liquibase.integration.spring.SpringLiquibase
beanName, changeLog, clearCheckSums, contexts, databaseChangeLogLockTable, databaseChangeLogTable, dataSource, defaultSchema, dropFirst, labels, liquibaseSchema, liquibaseTablespace, log, parameters, resourceLoader, rollbackFile, shouldRun, tag, testRollbackOnUpdate
-
-
Constructor Summary
Constructors Constructor Description AsyncSpringLiquibase(Executor executor, org.springframework.core.env.Environment env)
Constructor for AsyncSpringLiquibase.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
protected void
initDb()
initDb.-
Methods inherited from class org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase
destroy, setCloseDataSourceOnceMigrated
-
Methods inherited from class liquibase.integration.spring.SpringLiquibase
createDatabase, createLiquibase, createResourceOpener, getBeanName, getChangeLog, getContexts, getDatabaseChangeLogLockTable, getDatabaseChangeLogTable, getDatabaseProductName, getDataSource, getDefaultSchema, getLabels, getLiquibaseSchema, getLiquibaseTablespace, getResourceLoader, getTag, isClearCheckSums, isDropFirst, isIgnoreClasspathPrefix, isTestRollbackOnUpdate, performUpdate, setBeanName, setChangeLog, setChangeLogParameters, setClearCheckSums, setContexts, setDatabaseChangeLogLockTable, setDatabaseChangeLogTable, setDataSource, setDefaultSchema, setDropFirst, setIgnoreClasspathPrefix, setLabels, setLiquibaseSchema, setLiquibaseTablespace, setResourceLoader, setRollbackFile, setShouldRun, setTag, setTestRollbackOnUpdate, toString
-
-
-
-
Field Detail
-
DISABLED_MESSAGE
public static final String DISABLED_MESSAGE
ConstantDISABLED_MESSAGE="Liquibase is disabled"
- See Also:
- Constant Field Values
-
STARTING_ASYNC_MESSAGE
public static final String STARTING_ASYNC_MESSAGE
ConstantSTARTING_ASYNC_MESSAGE="Starting Liquibase asynchronously, your"{trunked}
- See Also:
- Constant Field Values
-
STARTING_SYNC_MESSAGE
public static final String STARTING_SYNC_MESSAGE
ConstantSTARTING_SYNC_MESSAGE="Starting Liquibase synchronously"
- See Also:
- Constant Field Values
-
STARTED_MESSAGE
public static final String STARTED_MESSAGE
ConstantSTARTED_MESSAGE="Liquibase has updated your database in "{trunked}
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE
public static final String EXCEPTION_MESSAGE
ConstantEXCEPTION_MESSAGE="Liquibase could not start correctly, yo"{trunked}
- See Also:
- Constant Field Values
-
SLOWNESS_THRESHOLD
public static final long SLOWNESS_THRESHOLD
ConstantSLOWNESS_THRESHOLD=5
- See Also:
- Constant Field Values
-
SLOWNESS_MESSAGE
public static final String SLOWNESS_MESSAGE
ConstantSLOWNESS_MESSAGE="Warning, Liquibase took more than {} se"{trunked}
- See Also:
- Constant Field Values
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws liquibase.exception.LiquibaseException
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classorg.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase
- Throws:
liquibase.exception.LiquibaseException
-
initDb
protected void initDb() throws liquibase.exception.LiquibaseException
initDb.
- Throws:
liquibase.exception.LiquibaseException
- if any.
-
-