Spring Boot allows us to replace our application.properties
files with YAML equivalents. However, I seem to hit a snag with my tests. If I annotate my TestConfiguration
(a simple Java config), it is expecting a properties file.
For example this doesn't work:
@PropertySource(value = "classpath:application-test.yml")
If I have this in my YAML file:
db:
url: jdbc:oracle:thin:@pathToMyDb
username: someUser
password: fakePassword
And I'd be leveraging those values with something like this:
@Value("${db.username}") String username
However, I end up with an error like so:
Could not resolve placeholder 'db.username' in string value "${db.username}"
How can I leverage the YAML goodness in my tests as well?