ConditionalOnProperty found different value in property 'enabled' even though enabled is set to true in application.yml
See original GitHub issueIn my @SpringBootTest annotated tests it won’t load the BraveAutoConfiguration automatically as it says that there is a different value in the property ‘enabled’
BraveAutoConfiguration:
Did not match:
- @ConditionalOnProperty (management.tracing.enabled) found different value in property 'enabled' (OnPropertyCondition)
Matched:
- @ConditionalOnClass found required classes 'brave.Tracer', 'io.micrometer.tracing.brave.bridge.BraveTracer' (OnClassCondition)
But in my application.yml in my test resources I have management.tracing.enabled set to true. (it is true by default but that doesn’t seem to matter)
spring:
profiles:
active: test
debug: true
management:
tracing:
enabled: true
When I start my application it does find the BraveAutoConfiguration and the application.yml has the same property set to true.
My test is annotated with the following annotations
@ActiveProfiles("test")
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ContextConfiguration
@AutoConfigureMockMvc
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
The Spring @ConditionalOnProperty Annotation - Baeldung
In short, the @ConditionalOnProperty enables bean registration only if an environment property is present and has a specific value.
Read more >ConditionalOnProperty on a Bean, which must be loaded ...
Now my question is there any way of doing this in one @ConditionalOnProperty annotation, if yes, so please paste here the working example....
Read more >Allow @ConditionalOnProperty NOT to match if the property ...
Use havingValue to restrict the value that the condition will match; Set the property value to false. If these don't meet your needs...
Read more >Spring @ConditionalOnProperty Example - Roy Tutorials
I have matchIfMissing = true in the @ConditionalOnProperty and it means that if the property module.enabled does not exist, it will still be...
Read more >ConditionalOnProperty (Spring Boot 3.0.0 API)
The string representation of the expected value for the properties. boolean. matchIfMissing. Specify if the condition should match if the property is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks, it’s working now.
If you want to have tracing in your integration tests, you need to use
@AutoConfigureObservabilityas documented here.