spring-boot - application.properties & application.yml 中相同属性的优先顺序
问题描述
我有一个使用 application.yml 文件存储属性的 spring boot (2.3.4.RELEASE) 应用程序 -
management:
endpoints:
enabled-by-default: true
web.exposure.include: "*"
endpointmetrics:
enabled: true
该应用程序在包含 application.properties 文件的类路径上还有一个 3rd 方依赖项 jar。该文件包含(注意运行状况检查端点) -
management.endpoints.web.exposure.include=*
management.endpoints.web.base-path=/
management.endpoints.web.path-mapping.health=healthcheck
在运行应用程序时,默认执行器健康检查端点 /actuator/health 返回未找到并且 /healthcheck 端点工作正常。
但是,如果我将 application.yml 文件转换为 application.properties 格式 -
management.endpoints.enabled-by-default=true
management.endpoints.web.exposure.include=*
management.endpointmetrics.enabled=true
然后默认执行器健康检查端点 /actuator/health 工作,/healthcheck 端点返回 404。
我有2个问题-
- 为什么我的 application.properties 文件优先于 3rd 方 jar 中的 application.properties 文件而不是我的 application.yml 文件?
- 我想在我的应用程序中使用 application.yml 格式并忽略第 3 方 jar 中的 application.properties 文件。有可能这样做吗?
解决方案
推荐阅读
- unity3d - Base.OnInspectorGUI 的真正用途是什么?
- php - PayPal Here / Sideloader 不使用 returnURL
- python - 不准确的异常值与箱线图中的异常值不匹配
- android - 在 kotlin 中使用 mockito 或 hamcrest 的数据类的单元测试用例如何以及什么是单元测试用例
- coldfusion - 重置应用程序时如何防止错误?
- django - django-tenant-schemas 1.10.0: TypeError: TenantTutorialMiddleware() 不接受任何参数
- php - 我将如何在网页上获取用户定义的值并将这些值替换为 URL 重定向?
- sql - Pl sql Proc 或更新语句,用于从缩写到完整形式的地址更正
- php - dayGridMonth 不可选择的全日历
- python - 定制的frozen_inference_graph.pb 不起作用?