My Spring Boot application which uses FlyWay enterprise license does not start and says the following message:
Caused by: org.flywaydb.core.api.FlywayException: Missing license key.
Ensure flyway.licenseKey is set to a valid Flyway license key ("FL01" followed by 512 hex chars)
The license is actually not missing. I've tried to set both as an env variable and in application.yml file with the name spring >> flyway >> licenseKey, but it is not reacting at all.
Any ideas where could the problem be hidden? The other env variables are considered by spring boot for database so this should not be the problem.
There is a good discussion of this on GitHub. According to that issue, a property-based version of this appears to be on the roadmap for Spring Boot 2.2.
Apparently for now you need to implement a FlywayConfigurationCustomizer
(Untested):
@Configuration
public class FlywayConfiguration {
@Bean
public FlywayConfigurationCustomizer customizeLicense(
@Value("${my-app.flyway.license}") String license) {
return new FlywayConfigurationCustomizer() {
@Override
public void customize(FluentConfiguration configuration) {
configuration.licenseKey(license);
}
};
}
}
I think that can probably be simplified to a lambda (also untested)...
@Configuration
public class FlywayConfiguration {
@Bean
public FlywayConfigurationCustomizer customizeLicense(
@Value("${my-app.flyway.license}") String license) {
return configuration -> configuration.licenseKey(license);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With