Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 295
Pragmatick Avatar asked Aug 18 '18 05:08

Pragmatick


1 Answers

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.

like image 143
Andy Wilkinson Avatar answered Oct 16 '22 11:10

Andy Wilkinson