Pragmatick
Pragmatick

Reputation: 130

Flyway deprecation message logged when using Spring Boot 2

I use Spring Boot 2.0.4.RELEASE with Flyway 5.1.4. When starting my Spring Boot application I get the warning Flyway.setCallbacks(FlywayCallback) has been deprecated and will be removed in Flyway 6.0. Use Flyway.setCallbacks(Callback) instead.

This seems to be caused by Spring Boot as I don't configure any callbacks myself. Is there any way to disable this warning or prevent its root cause?

Upvotes: 6

Views: 1379

Answers (1)

Andy Wilkinson
Andy Wilkinson

Reputation: 116091

The problem is occurring because you are using Flyway 5.1 with Spring Boot 2.0. Spring Boot 2.0 compiles against, and provides dependency management for, Flyway 5.0 where the setCallbacks(FlywayCallback[]) has not been deprecated and does not generate a warning when called.

If you want to continue using Boot's auto-configuration then, at the time of writing, you have a couple of options:

  1. Drop back to Flyway 5.0.x by remove your override of Flyway's version and allowing Spring Boot's dependency management to control the version.
  2. Customise your logging configuration so that the warning isn't logged.

It should be possible to improve the situation in Spring Boot 2.0.x. Currently, setCallbacks(FlywayCallback[]) is called even when the array is empty. That's benign with Flyway 5.0, but unnecessarily generates the warning you are seeing with 5.1. This issue will address that.

Upvotes: 7

Related Questions