Reputation: 71
I am trying to understand something about the following application.properties syntax in spring
some-api:
url: ${variable.url:http://localhost:8080}
I know that to get the value of the above we use (for example)
@Value("${some-api.url}")
private String url;
what's the point of declaring ${variable.url:VALUE}
when I reference it with some-api.url
? where do you use this ?
also can you call this value in pom.xml
?
Upvotes: 0
Views: 247
Reputation: 1212
In your example properties file you are referring another property, like this is how your application.yml must be looking
variable:
url: http://host
some-api:
url: ${variable.url:http://localhost:8080}
and vaue after :
is the default value when variable.url
is not defined.
also can you call this value in pom.xml ?
No, you need some maven plugin which can read your properties file in order to do that.
Upvotes: 1