milk100500
milk100500

Reputation: 1

How to integrate liquibase with spring data reactive?

Have anybody tried to integrate liquibase with spring reactive stack? From what I've googled, liquibase still doesn't support r2dbc driver and it requires you to add both spring data jdbc & r2dbc dependencies. It works well with an empty project - but if there are already any repositories, both spring data jdbc & r2dbc try to resolve them and application fails. Perhaps there's a way to disable spring data jdbc repositories so it only works with the liquibase?

Upvotes: 0

Views: 1219

Answers (1)

mipo256
mipo256

Reputation: 3150

The problem is that liquibase itself executes the migrations via JDBC, the blocking API. It mainly because liquibase precedes R2DBC significantly, and at the time there was no R2DBC.

There are a couple of ways to solve this problem. First is to use liquibase plugin (maven or gradle) or CLI. This is the most robust way in the sense that way you would not have a JDBC driver at runtime class path of the application, which actually you do not want since it may trigger spring to bootload some autoconfiguration that is irrelevant and can interfere with the application.

The second option is of course to include both R2DBC and JDBC drivers at application's runtime classpath. This is fine, in general, and also an option, but see the first option to understand why it may be a bit trickier to set up. Look in here for examples.

Upvotes: 0

Related Questions