Reputation: 3978
I am using yml
properties for spring boot app. I am getting error on yml
as below:
onboarding:
api:
something:
attribute1:
attribute2:
somethingElse:
atribute:
base-url: http://enpoint.elasticbeanstalk.com
users: /users ## error here on colon symbol
save-update: /users/save-update
My usage is as below:
@Value("${onboarding.api.base-url.users}")
@Value("${onboarding.api.base-url.users.save-update}")
What am I doing wrong? Getting same error on any online parser too.
Upvotes: 1
Views: 8968
Reputation: 39688
In YAML, every key has one value. A scalar is a value. A nested mapping is also a value. Apparently, you try to give the key base-url
two values, the first one being an URL (which is a scalar) and the second one being a mapping containing a key users
. That won't work.
So YAML parses http://enpoint.elasticbeanstalk.com
and sees „okay, this key contains a scalar value“ and then on the next line, you start a nested mapping. This is what the error message is trying to tell you.
This would be valid YAML:
onboarding:
api:
something:
attribute1:
attribute2:
somethingElse:
atribute:
base-url: http://enpoint.elasticbeanstalk.com
users: /users
save-update: /users/save-update
so would this:
onboarding:
api:
something:
attribute1:
attribute2:
somethingElse:
atribute:
base:
url: http://enpoint.elasticbeanstalk.com
users:
path: /users
save-update: /users/save-update
Upvotes: 1