In the test classes that load the spring context (such as @SpringBootTest), Spring Boot doesn't load the application.yaml (or application.yml) file from the test resources by default. It requires an additional annotation on a test class level to point to a specific configuration file. However, for an application.properties file located in test resources, no additional annotation is required - spring out of the box, will know that it needs to load properties from that file. It seems like an oversight since both, application.yaml and application.properties are supported in the main resources.

Comment From: wilkinsona

Both application.properties and application.yaml are loaded from the same locations so both should work when placed in src/test/resources as your build system or IDE should make these resources available on the classpath. It's not clear from what you have described why that isn't happening for you. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: quaff

@plintner I assume you have problems running tests in IDE like Eclipse, please try gradle or maven directly.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.