Create spring-boot starter

Hi there,
I am used to flyway and wanted to test liquibase as an alternative. In devon4j (https://devonfw.com) we also provide full solutions to build apps and IT landscapes following best practices and therefore are about to support liquibase alongside flyway.

With flyway I observed that it has spring-boot integration out of the box:
You only need to have flyway on your classpath and it is automatically configured in spring-boot.

With liquibase this is however not the case. I researched and found this documentations:
https://docs.liquibase.com/tools-integrations/springboot/home.html

Studying those gives me the impression that this is rather outdated from my PoV as nobody is using spring XML config anymore with spring-boot.

What I am therefore wondering is: Why dont you simply provide a spring-boot-starter-liquibase that projects could add as a dependency to get both the classic liquibase dependency as well as the autoconfiguration and ingeration into spring-boot via spring.factories?
IMHO this would be a nice improvement to liquibase that can be done extremely easy.

WDYT? I am happy to assist in case you may not be familiar with the details how to build spring-boot starters.

Cheers
Jörg

The liquibase spring integration works the same as the Flyway version: you simply add Liquibase to the classpath. The start.spring.io setup in Using Liquibase with Spring Boot does that for you in the spring style you need.

The XML example on that page is for the Liquibase changelog which can be in xml, yaml, json, or sql depending on your preference.

Are you having troubles getting it working?

Nathan

Hi Nathan,
thanks for your answer.
I was referring to XML like that looks pretty much like spring-xml:

                   <bean  id="liquibase"  class="liquibase.integration.spring.SpringLiquibase">  

When we have this dependency together with spring-boot:

<dependency>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-core</artifactId>
<dependency>

We are unable to access liquibase via dependency-injection as it does not seem to be in the spring-context as a “spring-bean”. This works fine for flyway OOTB.

In devon4j we want to add liquibase support but still face such issues:

Kind regards
Jörg

Sorry for the slow responses. Was traveling last week…

Looking at the PR you have in devon4j, what is the problem part you are hitting? There’s a lot in there and I’m not sure what is expected code changes and what is unexpected.

Nathan

Hi Nathan,
as written above:
The problem is that liquibase (liquibase.Liquibase) is not available as spring-bean for injection. We need this e.g. in JUnits to reset DB and avoid side-effects from previous runs.
This works for flyway (that we can simply receive via “@Inject Flyway flyway”) but not for liquibase ("@Inject Liquibase liquibase" is giving us UnsatisfiedDependencyException).

Any hints or suggestions how to make it work with liquibase?

Thanks
Jörg

That liquibase dependency you add should be all you need to do. I’ve seen it working before just fine without needing to specify the bean in a spring xml file.

What version of liquibase is getting included in your project? Perhaps a different dependency is keeping it at strangely old version?