I'm working on a Java app with configuration stored in the application.yaml file, with endpoints defined as plain strings as follows:
security:
oauth2:
client:
provider:
keycloak:
token-uri: path/to/somewhere
authorization-uri: path/to/somewhere
userinfo-uri: path/to/somewhere
And so on. The thing is, I don't like the idea of keeping the endpoints defined as plain strings here, I would strongly prefer to import them from somewhere else in the app, e.g. from a Java enum. But as far as I can see there is no real way to use variables in YAML, so what are my options?
CodePudding user response:
You can use placeholders like this:
app:
name: "MyApp"
description: "${app.name} is a Spring Boot application written by ${username:Unknown}"
See docs for reference