Spring Boot: Load @Value from YAML file
For example: application.yml
key: name: description here
Your Class:
@Value("${key.name}")private String abc;
M. Deinum is right, the setup i've provided is working - the yml
file was indented wrong, so the property couldn't be found.
I found the above wasn't working for me, because I tried to access the variable in a constructor. But at construction, the value is not injected yet. Eventually I got it to work using this workaround: https://mrhaki.blogspot.com/2015/04/spring-sweets-using-value-for.html
Maybe this is helpful to others.