Skip to content

Flyway Callbacks and JavaMigrations configured in FlywayConfigurationCustomizer are overwritten by beans of the same type #32070

Closed
@oliverhenlich

Description

@oliverhenlich

I'm trying to configure where/how to find the flyway callbacks using the FlywayConfigurationCustomizer with something like the following.

configuration.callbacks("db");

On debugging why this was not working I saw that FlywayAutoConfiguration seems to be overwriting any changes to the list of callbacks that may have been made by a FlywayConfigurationCustomizer.

Starting with the code here FlywayAutoConfiguration.java#L120 it seems that:

  1. FlywayAutoConfiguration: auto discovered spring components that implement Callback are used to configure flyway.
  2. My customizer: configures the flyway callbacks.
  3. FlywayAutoConfiguration: replaces list of callbacks with the same list from 1.

Incidentally, it seems to do this by calling two differently named methods that have exactly the same content configureCallbacks and configureFlywayCallbacks.

Spring Boot: 2.7.0

Metadata

Metadata

Assignees

Labels

status: noteworthyA noteworthy issue to call out in the release notestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions