Spring Boot Version:1.5.10
When I try to override a property in application.yml file while executing some tests, application still uses the main property instead of the one in application-test.yml.
I created a simple project to reproduce the issue: https://github.com/selmantayyar/SpringBootPropertyOverrideIssue
Please be aware that with *.properties file,issue does not exist.
Comment From: snicoll
Thanks for the sample. @PropertySource and @TestPropertySource do not support yaml files. I've raised SPR-16563 to remind me to document that
Comment From: selmantayyar
Thanks for the prompt reply! So can I assume that only way to override YAML is place application.yml under test/resources/config directory?
Comment From: snicoll
No, @SpringBootTest has a properties attribute you can use to override individual properties. If you have more questions, please ask on StackOverflow or join us on Gitter.
Comment From: Manu10744
I don't understand why Spring offers .yaml as an alternative to .properties files but at the same time does not support overriding properties with @TestPropertySource(properties = ...)
Why should i have to use a Spring Boot Dependency (spring-boot-test) if I'm working on a Spring BATCH application?? Doesnt make sense to me.
Using @SpringBootTest didn't even work for me, it just ignored the property..