spring - 是否可以在 spring-boot application.yaml 或 properties 中使用占位符 ${} 作为属性 KEY
问题描述
我想知道是否可以不仅在值中使用占位符替换,还可以在弹簧引导application.yaml
(或.properties)中使用占位符替换。
例如:
openapi:
security:
- my-resource
- ${some.path.role-a}
- ${some.path.role-b}
工作就像一种魅力,这里没什么特别的。但是,如果我还需要从“占位符”中获取“我的资源”怎么办?那可能吗?
已经尝试过不同的方法,例如:
openapi:
security:
- ${some.path.resource}
- ${some.path.role-a}
- ${some.path.role-b}
或者
openapi:
security:
- "${some.path.resource}"
- ${some.path.role-a}
- ${some.path.role-b}
但是一切都只产生变量名作为键。
解决方案
推荐阅读
- windows - Jmeter.bat 没有正确处理参数
- node.js - 均衡获取最近的位置获取点
- python - socket.socket() 没有参数是 TCP 或 UDP
- scala - 将标题(列名)转换为新的数据框
- c# - 有没有办法为进程创建的所有任务全局 WaitAll() ?
- c++ - c++ VS 2010 到 VS 2019 升级。升级后需要 const 参数列表。为什么?
- java - 在入口点访问 dockerfile ENV 变量
- python - 使用“--extra-index-url”安装的 pip3 无法解决依赖关系
- konvajs - React+Konva:如何使用 strokeLinearGradientColorStops?
- perl - 在 Perl 脚本中,我可以打开/写入/关闭一个文件,但是当我尝试对其进行集群时,我得到“错误的文件描述符”