Problem:

When debugging property sources in a Spring Boot test, properties programmatically injected via TestPropertyValues (often within a ContextCustomizer) appear in the Environment with the PropertySource name 'configurationProperties'.

This term('configurationProperties') is easily confused with @ConfigurationProperties and is mentally jarring - our mental model of @ConfigurationProperties is as a consumer of properties and not a supplier.

// source of property
// file: ObservabilityContextCustomizerFactory.java 
TestPropertyValues.of("management.tracing.enabled=false").applyTo(context);

My suggestion would be to use an explicit name like testPropertyValuesProperties: this will immediately key the troubleshooting process to look for ContextCustomizers or other programmatic sources of properties.

--- Debugging Property: management.tracing.enabled ---
Final resolved value for 'management.tracing.enabled': false
Searching for 'management.tracing.enabled' in property sources (highest precedence first in list):
  -> Found in PropertySource: 'configurationProperties'
     Value: 'false'
     Type: org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource
     Simple Type Name: ConfigurationPropertySourcesPropertySource
  -> Found in PropertySource: 'Config resource 'class path resource [application-test.yml]' via location 'optional:classpath:/''
     Value: 'true'
     Type: org.springframework.boot.env.OriginTrackedMapPropertySource
     Simple Type Name: OriginTrackedMapPropertySource

Further Consideration: Documentation Clarity for "Superpower" Properties

Beyond the PropertySource naming, I've observed that for certain "superpower" properties, such as management.tracing.enabled, the exact mechanisms and recommended approaches for overriding them can sometimes be less clear in the official documentation. Perhaps for such properties the override mechanism (e.g. @AutoConfigureObservability) could be linked to?

Specific example: management.tracing.enabled could do with a marker that for testing it has superpowers and a link to @AutoConfigureObservability

Comment From: wilkinsona

The property source that's created by TestPropertyValues is named test.

You are being confused by ConfigurationPropertySourcesPropertySource. It's a special property source that wraps all of the other sources and provides relaxed binding capabilities for @ConfigurationProperties. You need to account for this source when examining the environment as the EnvironmentEndpoint does:

https://github.com/spring-projects/spring-boot/blob/81a4a33f6290ef2aec03f4e4de8678f5564c91c8/module/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java#L163-L171

Specific example: management.tracing.enabled could do with a marker that for testing it has superpowers and a link to @AutoConfigureObservability

Please open a separate issue for this suggestion. I'm not sure if we'll want to document things at this level as we may consider it to be an implementation detail of the annotation. We can certainly consider it though.