Hi, the following used to work with Spring Boot 2.5.6 (accessing the properties from src/test/resources/application-test.properties)

@SpringBootTest
@ActiveProfiles("test")
@AutoConfigureMockMvc
class SomeClassIT {

    @Autowired
    private MockMvc mockMvc;

    @Value("${info.app.name}")
    private String appName;

    @Test
    public void testEndpointInfo() throws Exception {
        mockMvc.perform(get("/info")).andDo(print())
            .andExpect(status().isOk())
            .andExpect(jsonPath("$.build.name").value(appName))
    }
}

but ignores the test properties file after upgrading to 2.6.0: the value for appName is the one from the default application.properties. What do we need to change to make the properties from src/test/resources/application-test.properties override the default ones, as it used to do?

PS: I have been told this problem appeared with SB 2.5.7 but I haven't tested.

Comment From: wilkinsona

@JeromeSimmonds As @mbhave requested, can you please share a small sample that we can run that reproduces the problem? You can share it with us by zipping it up and attaching it this issue or by pushing it to a separate repository on GitHub.

Comment From: JeromeSimmonds

It's going to take me some time to extract the minimum code required from my project to be able to share here (the code I already shared could be added to any Spring Boot project though...), in the meantime can you folks confirm that using those annotations

@SpringBootTest
@ActiveProfiles("test")

still overrides the application.properties values with the ones in src/test/resources/application-test.properties with the Spring Boot app automatically started for the test? This line that is now failing .andExpect(jsonPath("$.build.name").value(appName)) indicates that the Spring Boot app gets its properties from application.properties hence the test failure.

Comment From: antti-markus-cko

Not able to reproduce with Spring Boot 2.6.1 https://github.com/antti-markus-cko/issuedemo

Comment From: JeromeSimmonds

@antti-markus-cko have you tested with the application-test.properties file in the src/test/resources folder, as I do (and where config files should normally be for tests)?

Comment From: JeromeSimmonds

@antti-markus-cko so I tested your project after moving the file to the test folder and it still works. Now I think the problems comes from the way Actuator gets the values to generate the /info response payload... Maybe it doesn't use info.app.name anymore...

Comment From: wilkinsona

This sort of thing is why we really need a minimal example that reproduces the problem. Unfortunately, we can't investigate a problem that is vague.

Comment From: Jeff-Steele

My team is experiencing this same issue, we upgraded from Spring Boot 2.4.6 to Spring Boot 2.4.13. The problem is not 100% guaranteed to happen. Sometimes it will load the application-test.yml file and other times it will apparently ignore it. We are using maven, when I clean the project and let IntelliJ build my integration test project that has the application-test.yml and the tests that utilize it, it appears to be happy, however, when I maven install then it appears to ignore the file. At least, that is what I noticed this morning.

Comment From: Jeff-Steele

Additional update, we are copying resources from a different location into our integration tests.

${basedir}/../resources/src/main/resource

So this may have broken for us a while ago and we just didn't notice until more recently. However, adding another testResoruce for the current projects resources places the file in place so it can be loaded. Not sure if this is the same problem the original poster is having as well.

Comment From: JeromeSimmonds

@antti-markus-cko @wilkinsona latest update: so the Actuator /info endpoint that I test in the snippet of code I shared, used to return the value of info.app.name defined in properties files. A recent version of Actuator changed the format of the response and now returns a build.name field which I thought would still use the info.app.name var, but it's not the case if I understand https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.info.auto-configured-info-contributors correctly (I use Maven and it gets the value from the pom file apparently).

I understand the problem now, thank you for trying to help!

Comment From: wilkinsona

@JeromeSimmonds Correct, the info contributor that exposes every property in the environment that begins with info. is disabled by default in Spring Boot 2.6. Thanks for letting us know you'd figured out the problem.