Liquibase is a great DB migration tool that have been around for a while and is stable to use in production systems.

An convenient way of running Liquibase in Spring application start Liquibase via Spring – when the application starts the Liquibase runs automatically and updates the database when needed.

This is a code snippet that:

  1. Setting up an Spring Java Config file
  2. Expects that there are a Spring wired DataSource available
  3. Reads the Liquibase changelog.xml file from classpath
  4. Adds contexts that can be used inside the change log for different profiles
  5. Initiates and creates a SpringLiquibase instance
  6. Settings the log level to verbose

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.