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
FieldsModifier and TypeFieldDescriptionstatic final StringConstantDISABLED_MESSAGE="Liquibase is disabled"static final StringConstantEXCEPTION_MESSAGE="Liquibase could not start correctly, yo"{trunked}static final StringConstantSLOWNESS_MESSAGE="Warning, Liquibase took more than {} se"{trunked}static final longConstantSLOWNESS_THRESHOLD=5static final StringConstantSTARTED_MESSAGE="Liquibase has updated your database in "{trunked}static final StringConstantSTARTING_ASYNC_MESSAGE="Starting Liquibase asynchronously, your"{trunked}static final StringConstantSTARTING_SYNC_MESSAGE="Starting Liquibase synchronously"Fields inherited from class liquibase.integration.spring.SpringLiquibase
beanName, changeLog, clearCheckSums, contexts, databaseChangeLogLockTable, databaseChangeLogTable, dataSource, defaultSchema, dropFirst, labelFilter, liquibaseSchema, liquibaseTablespace, log, parameters, resourceLoader, rollbackFile, shouldRun, tag, testRollbackOnUpdate -
Constructor Summary
ConstructorsConstructorDescriptionAsyncSpringLiquibase(Executor executor, org.springframework.core.env.Environment env) Constructor for AsyncSpringLiquibase. -
Method Summary
Methods inherited from class org.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase
destroy, setCloseDataSourceOnceMigratedMethods inherited from class liquibase.integration.spring.SpringLiquibase
createDatabase, createLiquibase, createResourceOpener, getBeanName, getChangeLog, getContexts, getDatabaseChangeLogLockTable, getDatabaseChangeLogTable, getDatabaseProductName, getDataSource, getDefaultSchema, getLabelFilter, getLabels, getLiquibaseSchema, getLiquibaseTablespace, getResourceLoader, getTag, isClearCheckSums, isDropFirst, isIgnoreClasspathPrefix, isTestRollbackOnUpdate, performUpdate, setBeanName, setChangeLog, setChangeLogParameters, setClearCheckSums, setContexts, setDatabaseChangeLogLockTable, setDatabaseChangeLogTable, setDataSource, setDefaultSchema, setDropFirst, setIgnoreClasspathPrefix, setLabelFilter, setLabels, setLiquibaseSchema, setLiquibaseTablespace, setResourceLoader, setRollbackFile, setShouldRun, setTag, setTestRollbackOnUpdate, toString
-
Field Details
-
DISABLED_MESSAGE
ConstantDISABLED_MESSAGE="Liquibase is disabled"- See Also:
-
STARTING_ASYNC_MESSAGE
ConstantSTARTING_ASYNC_MESSAGE="Starting Liquibase asynchronously, your"{trunked}- See Also:
-
STARTING_SYNC_MESSAGE
ConstantSTARTING_SYNC_MESSAGE="Starting Liquibase synchronously"- See Also:
-
STARTED_MESSAGE
ConstantSTARTED_MESSAGE="Liquibase has updated your database in "{trunked}- See Also:
-
EXCEPTION_MESSAGE
ConstantEXCEPTION_MESSAGE="Liquibase could not start correctly, yo"{trunked}- See Also:
-
SLOWNESS_THRESHOLD
public static final long SLOWNESS_THRESHOLDConstantSLOWNESS_THRESHOLD=5- See Also:
-
SLOWNESS_MESSAGE
ConstantSLOWNESS_MESSAGE="Warning, Liquibase took more than {} se"{trunked}- See Also:
-
-
Constructor Details
-
AsyncSpringLiquibase
Constructor for AsyncSpringLiquibase.
- Parameters:
executor- aExecutorobject.env- aEnvironmentobject.
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet() throws liquibase.exception.LiquibaseException- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.springframework.boot.autoconfigure.liquibase.DataSourceClosingSpringLiquibase- Throws:
liquibase.exception.LiquibaseException
-
initDb
protected void initDb() throws liquibase.exception.LiquibaseExceptioninitDb.
- Throws:
liquibase.exception.LiquibaseException- if any.
-