It seems, that if flywayDatasource is not defined, the bean "flywayDatasource" will be populated by the datasource and therefor won't be null. Which doesn't seem to be the logic implemented.

type of conf that doesn't work and used to work :

spring:
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: jdbc:mysql://localhost:3306/xxx
    username: username
    password: password
  flyway:
    url: jdbc:mysql://localhost:3306/xxx
    user: username2
    password: password2

https://github.com/spring-projects/spring-boot/blob/f9363569abbbce80c2c4f318d936365d9a7678ea/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java#L166-L194

Comment From: alexisgayte

Seems to be a bit more complicated hence I reopen it.

This is strange. should it take priority over the flyway definition?

    if (flywayDataSource != null) { 
        return flywayDataSource; 
    } 

Feel free to close the issue.