Add Liquibase support
When running a Spring Boot app with Liquibase enabled the following error occurs:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.UnexpectedLiquibaseException: Cannot create default configuration liquibase.configuration.GlobalConfiguration
...
Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot create default configuration liquibase.configuration.GlobalConfiguration
at liquibase.configuration.LiquibaseConfiguration.createConfiguration(LiquibaseConfiguration.java:123) ~[na:na]
at liquibase.configuration.LiquibaseConfiguration.getConfiguration(LiquibaseConfiguration.java:88) ~[na:na]
at liquibase.configuration.LiquibaseConfiguration.getProperty(LiquibaseConfiguration.java:113) ~[na:na]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:297) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[na:na]
... 19 common frames omitted
Caused by: java.lang.NoSuchMethodException: liquibase.configuration.GlobalConfiguration.<init>()
at java.lang.Class.getConstructor0(DynamicHub.java:3349) ~[na:na]
at java.lang.Class.getConstructor(DynamicHub.java:2151) ~[na:na]
at liquibase.configuration.LiquibaseConfiguration.createConfiguration(LiquibaseConfiguration.java:119) ~[na:na]
... 24 common frames omitted
Seems like there are not hints implemented for Liquibase - see Quarkus implementation for inspiration
I have tried to adapt the Quarkus rules in this branch : LiquibaseHints.java
Then I run into this error:
Caused by: liquibase.exception.UnexpectedLiquibaseException: Cannot find LockService for unsupported
at liquibase.lockservice.LockServiceFactory.getLockService(LockServiceFactory.java:74) ~[na:na]
at liquibase.Liquibase.update(Liquibase.java:182) ~[na:na]
at liquibase.Liquibase.update(Liquibase.java:178) ~[na:na]
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:368) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:316) ~[com.example.liquibasedemo.liquibasedemoapplication:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782) ~[na:na]
... 19 common frames omitted
There is already a PR in Liquibase that will fix this for 4.x (which will be used in Spring Boot 2.5): https://github.com/liquibase/liquibase/pull/1582
(tried that with Spring Boot 2.5.0-M3 and that works)
Nice so I close this issue.
@sdeleuze I thought more about taking the PR as an inspiration for a Spring Boot 2.4 backport.
I also think that Spring Native should add the Liquibase Changset files (like Quarkus does here https://github.com/quarkusio/quarkus/blob/3caaf4b4c66bd0ba11caa4fde528ed2854dace9b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java#L271)
The issue with Spring Boot 2.4 is the class org.springframework.boot.liquibase.SpringPackageScanClassResolver - this breaks the service discovery with native-image.
I prefer to wait for Spring Boot 2.5 and proper support, it will be released shortly.
Liquibase just closed the PR https://github.com/liquibase/liquibase/pull/1582 - seems like Spring has to deal with it (like Quarkus and Micronaut do)
Ok let's reopen it for tracking purpose. I added a comment here I think the next step would be contributing a testing PR on Liquibase side.
Notice that there should be a native configuration repository in a few months for this kind of need, and that GraalVM 21.3 will changes a few rules regarding native configuration, so probably better to wait for it.
See the configuration crafted in #1118.
See also my related comment on Liquibase side.
Hi!
Any update on that?
Yes support has been added to https://github.com/oracle/graalvm-reachability-metadata. See below the generic closing comment with more information.
Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.
As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the GraalVM Reachability Repository project.
Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.