dubbo
dubbo copied to clipboard
[Bug] In the example dubco-samples-spring-boot-trace-skywalking, the run fails
Pre-check
- [X] I am sure that all the content I provide is in English.
Search before asking
- [X] I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java Samples (apache/dubbo-samples)
Dubbo Version
Dubbo: 3.2.6 JDK: 1.8 SpringBoot: 2.6.4
Steps to reproduce this issue
run error
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method applicationModel in org.apache.dubbo.springboot.skywalking.demo.provider.ObservationConfiguration required a bean of type 'io.micrometer.observation.ObservationRegistry' that could not be found.
Action:
Consider defining a bean of type 'io.micrometer.observation.ObservationRegistry' in your configuration.
What you expected to happen
Class:ObservationConfiguration Method:applicationModel Param: ObservationRegistry observationRegistry Unknown source, need to inject?
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- [X] Yes I am willing to submit a pull request on my own!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@conghuhu @songxiaosheng PTAL
@xiaozhigang PATL
your jdk:1.8 requirement:jdk-17
your jdk:1.8 requirement:jdk-17
Support 1.8, do not change 17 org.apache.dubbo.springboot.skywalking.demo.provider.ObservationConfiguration add fix code:
@ConditionalOnBean(ObservationRegistry.class)
@Bean
ApplicationModel applicationModel(@Autowired ObservationRegistry observationRegistry) {
ApplicationModel applicationModel = ApplicationModel.defaultModel();
observationRegistry.observationConfig()
.observationHandler(new ObservationHandler.FirstMatchingCompositeObservationHandler(
new SkywalkingSenderTracingHandler(), new SkywalkingReceiverTracingHandler(),
new SkywalkingDefaultTracingHandler()
));
applicationModel.getBeanFactory().registerBean(observationRegistry);
return applicationModel;
}