gpt4 book ai didi

java - 我的两个HealthIndicator的配置都读不到

转载 作者:行者123 更新时间:2023-12-01 09:08:38 25 4
gpt4 key购买 nike

我编写了两个 HealthIndicator,一个是实现 HealthIndicator Java 接口(interface)的 CustomHealthIndicator.java,另一个是对 HSM 执行 ping 操作的自己的 HSMHealthIndicator.java。当我编码时,我将此配置放在 application.properties 中:

management.security.enabled=true
endpoints.health.sensitive=false
endpoints.health.enabled=true
endpoints.health.time-to-live=15000

几天前,我的老板在 application.yml 配置文件中移动了这些键/值:

management:
security:
enabled: true
endpoints:
health:
sensitive: false
enabled: true
time-to-live: 15000

因为在我们的应用程序中,与 .properties 相反,.yml 不应该被外部化(因为它不应该由用户编辑,因此在构建过程中 Maven 不会将其复制到“target”目录中)。

问题是我注意到我的代码不再读取键/值。事实上,当我连接到 http://localhost:8080/health 时唯一显示的是:

{"status":"UP"}

而我以前有:

{"status":"UP","custom":{"status":"UP"},"diskSpace":{"status":"UP","total":107374178304,"free":25598341120,"threshold":10485760},"db":{"status":"UP","database":"PostgreSQL","hello":1}}

其他证据:当我连接到我的自定义端点 ( http://localhost:8080/HSMAndDbHealth ) 时,我现在:

The JWT is missing from the 'Authentication'header 

而我以前有:

{"code":"UP","message":"Database and HSM are UP"}

为什么当我将配置执行器的键/值放入 application.yml 文件时,它们不会被读取?

最佳答案

可能有一个或多个空格字符被“损坏”。复制并粘贴几个工作键/值,并将这些键/值替换为您需要的键/值。

关于java - 我的两个HealthIndicator的配置都读不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41061830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com