My spring application reads a property (let's call my-property) before the application context starts. I've a class that extends EnvironmentPostProcessor. In the postProcessEnvironment method, some actions are taken based on my-property.

I've an integration test where I want to override my-propertys value defined in the application.yaml. Although the property in the end is overridden via @TestPropertySource#properties field, during the execution of postProcessEnvironment, the property's value processed is not the one defined by the @TestPropertySource but the one in the .yaml file.

It means that @TestPropertySource is processed by spring after EnvironmentPostProcessor#postProcessEnvironment

Would be possible to process @TestPropertySource first?

Comment From: SimoneGiusso

Actually it is set in the Environment but in a different PropertySource