@ Override public void afterPropertiesSet ( ) throws LiquibaseException { ConfigurationProperty shouldRunProperty = LiquibaseConfiguration . getInstance ( ) . getProperty ( GlobalConfiguration . class , GlobalConfiguration . SHOULD_RUN ) ; if ( ! shouldRunProperty . getValue ( Boolean . class ) ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . info ( LogType . LOG , "Liquibase did not run because " + LiquibaseConfiguration . getInstance ( ) . describeValueLookupLogic ( shouldRunProperty ) + " was set to false" ) ; return ; } if ( ! shouldRun ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . info ( LogType . LOG , "Liquibase did not run because 'shouldRun' " + "property was set " + "to false on " + getBeanName ( ) + " Liquibase Spring bean." ) ; return ; } Connection c = null ; Liquibase liquibase = null ; try { c = getDataSource ( ) . getConnection ( ) ; liquibase = createLiquibase ( c ) ; generateRollbackFile ( liquibase ) ; performUpdate ( liquibase ) ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } finally { Database database = null ; if ( liquibase != null ) { database = liquibase . getDatabase ( ) ; } if ( database != null ) { database . close ( ) ; } } }
Executed automatically when the bean is initialized .