I'm trying to upgrade the project that I'm currently working on from Spring Boot 1.2.8 to the latest version (1.4.0). I've discovered, that Spring Boot Actuator since version 1.3.0 exposes Flyway migrations as an Actuator endpoint. This endpoint takes as an argument a single Flyway bean.
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java#L187
My project uses multiple Flyway beans to manage migrations for a number of databases and when I try to start the application, Spring complains about a NoUniqueBeanDefinitionException.
When I disable EndpointAutoconfiguration the context is created correctly. I don't necessarily need the Flyway endpoint at this time, but there are other endpoints that we do use for monitoring, so I don't want to disable all of the endpoints. I've tried to disable the flyway endpoint in the application.properties file using
endpoints.flyway.enabled=false
but Spring still complains (I think it tries to create the endpoint bean anyway and the 'enabled' property is used to determine the availability of the endpoint at runtime).
I think currently my only option is to manually enable the endpoints that I need and disable autoconfiguration. Is that right?
And also, is there a reason, why the FlywayEndpoint only works with a single Flyway bean present? For what I understand, the constructor could just take a list of Flyway beans, the invoke() method could then iterate over them.
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java#L54
I think currently my only option is to manually enable the endpoints that I need and disable autoconfiguration. Is that right?
Yes, I think that's right. The behaviour you're seeing is a bug so I've opened an issue. We'll fix it in 1.4.1 and, perhaps, 1.3.8 as well.
And also, is there a reason, why the FlywayEndpoint only works with a single Flyway bean present?
No reason other than we hadn't considered your use case. I've opened an enhancement for the endpoint to support multiple Flyway beans (and the same for Liquibase too).
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