curly brace in spring boot default property value

Viewed 829

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.

1 Answers

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}}
Related