Zipkin_Traces icon indicating copy to clipboard operation
Zipkin_Traces copied to clipboard

循环引用问题

Open Yisaer opened this issue 7 years ago • 0 comments

我用spring-boot 1.5.13-REALSE 起了一个脚手架项目,然后试用了你的Zipkintool写了个demo。然后在启动项目时出现了循环引用的问题。

demo的源码可以在这查看


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.13.RELEASE)

2018-05-19 16:16:15.814  INFO 15748 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on DESKTOP-3RG0V61 with PID 15748 (D:\dem22\target\classes started by admin in D:\dem22)
2018-05-19 16:16:15.817  INFO 15748 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2018-05-19 16:16:15.847  INFO 15748 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6b26e945: startup date [Sat May 19 16:16:15 CST 2018]; root of context hierarchy
2018-05-19 16:16:16.455  INFO 15748 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-05-19 16:16:16.469  INFO 15748 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-05-19 16:16:16.469  INFO 15748 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.31
2018-05-19 16:16:16.526  INFO 15748 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-05-19 16:16:16.527  INFO 15748 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 683 ms
2018-05-19 16:16:16.593  INFO 15748 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-05-19 16:16:16.595  INFO 15748 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-05-19 16:16:16.595  INFO 15748 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-05-19 16:16:16.595  INFO 15748 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-05-19 16:16:16.595  INFO 15748 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-05-19 16:16:16.661  WARN 15748 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.github.kristofa.brave.spring.BraveClientHttpRequestInterceptor': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.hansonwang99.zipkintool.ZipkinConfiguration': Unsatisfied dependency expressed through field 'clientInterceptor'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'com.github.kristofa.brave.spring.BraveClientHttpRequestInterceptor': Requested bean is currently in creation: Is there an unresolvable circular reference?
2018-05-19 16:16:16.662  INFO 15748 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-05-19 16:16:16.675  INFO 15748 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-05-19 16:16:16.678 ERROR 15748 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

┌─────┐
|  com.github.kristofa.brave.spring.BraveClientHttpRequestInterceptor
↑     ↓
|  com.hansonwang99.zipkintool.ZipkinConfiguration (field private com.github.kristofa.brave.spring.BraveClientHttpRequestInterceptor com.hansonwang99.zipkintool.ZipkinConfiguration.clientInterceptor)
└─────┘



Process finished with exit code 1

Yisaer avatar May 19 '18 08:05 Yisaer