Is there any specific reason why you use AnnotationConfigContextLoader instead of (by default) SpringBootContextLoader ? The problem you are facing is not caused by the lack of a file in the classpath (you can copy application-test.yaml to either src/main/resources or src/test/resources with the same result), but the fact that AnnotationConfigContextLoader not uses the ConfigFileApplicationListener , which is responsible for setting the context, loading properties from well-known file locations (for example, application-{profile}.yaml in your case).
You can easily compare which properties load when using each bootloader. First, you can check what AnnotationConfigContextLoader does - just put a breakpoint on line 128 of the AbstractGenericContextLoader.java file and run the debugger in your favorite IDE:

Next, you can examine the variable context β environment β propertySources β propertySourceList . You will find 5 sources of property:

None of them load properties from configuration files, such as application.yml or application.properties .
Now do the same, but with the SpringBootContextLoader class. Delete first
loader = AnnotationConfigContextLoader.class
in MyEntityTest and place a breakpoint on line 303 in the SpringApplication.java file:

Here we are right before updating the application context. Now consider the variable context β environment β propertySources β propertySourceList :

The first difference that we see is that now we have 7 sources of properties instead of 5, as in the previous example. And most importantly - ConfigFileApplicationListener.ConfigurationPropertySources here. This class makes the application context aware of the existence of the application-{profile}.yaml .

So you can see that it is only a matter of using the right context loader. Replace
@ContextConfiguration(classes = { ChildCConfig.class }, loader = AnnotationConfigContextLoader.class)
from
@ContextConfiguration(classes = { ChildCConfig.class }, loader = SpringBootContextLoader.class)
or
@ContextConfiguration(classes = { ChildCConfig.class })
since this bootloader is standard when using the @SpringBootTest annotation, and you will make your test pass like a charm. Hope this helps.