简体   繁体   中英

curly brace in spring boot default property value

In my application.yml for my spring boot application I have this property:

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. It becomes ${SECRET_ADYEN_API_KEY:djhksy{f7dsadasb} , not simply djhksy{f7dsadasb which is the actual API key. How can I get around this? I tried escaping the { character with \ and \\ without luck.

Could you please try separating the default value (djhksy{f7dsadasb) to a different property just like below, It is working for me:

default-secret-key: djhksy{f7dsadasb
apiKey: ${SECRET_ADYEN_API_KEY:${default-secret-key}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM