opentracing-contrib / java-spring-web

OpenTracing Spring Web instrumentation
Apache License 2.0
107 stars 59 forks source link

Unmatched dependencies between beans #108

Closed scoof closed 5 years ago

scoof commented 5 years ago

ServerTracingAutoConfiguration has the following dependency: @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) but is also responsible for loading WebTracingProperties. SkipPatternAutoConfiguration depends on WebTracingProperties being loaded, but is not conditional on Type.SERVLET. Thus, if you run a unittest using webEnvironment = SpringBootTest.WebEnvironment.NONE, Spring will try to instantiate SkipPatternAutoConfiguration, but it will fail since WebTracingProperties is not in the ApplicationContext.

I'm sorry that I don't have a suggested solution, but I don't have the full overview of what is actually required or not in a WebEnvironment.NONE situation.

A reproducer is available at https://github.com/scoof/opentracing-contrib-java-spring-web-reproducer/

geoand commented 5 years ago

Thanks for reporting the issue.

I opened #109 which should fix the problem.