[英]curly brace in spring boot default property value
In my application.yml
for my spring boot application I have this property:在我的 spring 启动
application.yml
程序的 application.yml 中,我有这个属性:
apiKey: ${SECRET_ADYEN_API_KEY:djhksy{f7dsadasb}
The problem is that the API key contains a forward curly brace, which messes up the parsing of the key in the app.问题是 API 密钥包含一个前花括号,这会扰乱应用程序中密钥的解析。 It becomes
${SECRET_ADYEN_API_KEY:djhksy{f7dsadasb}
, not simply djhksy{f7dsadasb
which is the actual API key.它变成
${SECRET_ADYEN_API_KEY:djhksy{f7dsadasb}
,而不仅仅是djhksy{f7dsadasb
这是实际的 API 密钥。 How can I get around this?我该如何解决这个问题? I tried escaping the
{
character with \
and \\
without luck.我尝试了 escaping
{
字符与\
和\\
没有运气。
Could you please try separating the default value (djhksy{f7dsadasb) to a different property just like below, It is working for me:您能否尝试将默认值 (djhksy{f7dsadasb) 分隔为不同的属性,如下所示,它对我有用:
default-secret-key: djhksy{f7dsadasb
apiKey: ${SECRET_ADYEN_API_KEY:${default-secret-key}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.