简体   繁体   English

Spring Boot Actuator FlywayEndpoint不适用于多个Flyway bean

[英]Spring Boot Actuator FlywayEndpoint doesn't work with multiple Flyway beans

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). 我正在尝试将我正在处理的项目从Spring Boot 1.2.8升级到最新版本(1.4.0)。 I've discovered, that Spring Boot Actuator since version 1.3.0 exposes Flyway migrations as an Actuator endpoint. 我发现,从版本1.3.0开始,Spring Boot Actuator将Flyway迁移作为Actuator端点暴露出来。 This endpoint takes as an argument a single Flyway bean. 此端点将单个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 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. 我的项目使用多个Flyway bean来管理许多数据库的迁移,当我尝试启动应用程序时,Spring抱怨NoUniqueBeanDefinitionException。

When I disable EndpointAutoconfiguration the context is created correctly. 当我禁用EndpointAutoconfiguration时,正确创建上下文。 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. 我此时不一定需要Flyway端点,但是我们还有其他端点用于监控,因此我不想禁用所有端点。 I've tried to disable the flyway endpoint in the application.properties file using 我试图在application.properties文件中使用禁用flyway端点

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). 但是Spring仍然抱怨(我认为它无论如何都试图创建端点bean,'enabled'属性用于确定端点在运行时的可用性)。

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? 而且,还有一个原因,为什么FlywayEndpoint仅适用于单个Flyway bean? For what I understand, the constructor could just take a list of Flyway beans, the invoke() method could then iterate over them. 根据我的理解,构造函数可以只获取一个Flyway bean列表,然后invoke()方法可以迭代它们。

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/FlywayEndpoint.java#L54 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. 我们将在1.4.1和1.3.8中修复它。

And also, is there a reason, why the FlywayEndpoint only works with a single Flyway bean present? 而且,还有一个原因,为什么FlywayEndpoint仅适用于单个Flyway bean?

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). 我已经为端点打开了一个增强功能 ,以支持多个Flyway bean(对于Liquibase也是如此)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring-boot-starter-web-reactive + spring-boot-starter-actuator不能同时工作? - spring-boot-starter-web-reactive + spring-boot-starter-actuator doesn't work together? Spring Boot Actuator Endpoints 安全性不适用于自定义 Spring 安全配置 - Spring Boot Actuator Endpoints security doesn't work with custom Spring Security Configuration Spring boot 2 - Actuator 端点,/beans 端点在哪里 - Spring boot 2 - Actuator endpoint, where is /beans endpoint 弹簧启动执行器关闭不会终止无限循环 - Spring boot actuator shutdown doesn't terminate infinite loop Spring Boot Actuator不读取git.properties - Spring Boot Actuator doesn't read git.properties Spring 启动/石英 webapp 未发布“执行器/石英”端点 - Spring boot / quartz webapp doesn't publish the "actuator/quartz" endpoint Spring Boot 2 Actuator是否在外部Tomcat中工作 - Does Spring Boot 2 Actuator work in external Tomcat Spring Boot无法拦截执行器访问 - Spring Boot can't intercept actuator access Spring Actuator:使用多个自定义 RestTemplateBuilder bean 配置 CloudFoundryActuator 时出错 - Spring Actuator: Error configuring CloudFoundryActuator with multiple custom RestTemplateBuilder beans 我的一个属性似乎无法识别 spring-boot-starter-actuator - spring-boot-starter-actuator doesn't seem to be recognised by one of my properties
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM