ConditionalOnProperty found different value in property 'enabled' even though enabled is set to true in application.yml

See original GitHub issue

In 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:closed
  • Created 10 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
plebcitycommented, Dec 2, 2022

If you want to have tracing in your integration tests, you need to use @AutoConfigureObservability as documented here.

Thanks, it’s working now.

1reaction
mhalbrittercommented, Dec 2, 2022

If you want to have tracing in your integration tests, you need to use @AutoConfigureObservability as documented here.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found