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

搭建springBootZuul时出现以下异常:
The dependencies of some of the beans in the application context form a cycle:
┌──->──┐
| org.springframework.cloud.netflix.zuul.ZuulProxyAutoConfiguration (field private org.springframework.cloud.netflix.zuul.filters.discovery.ServiceRouteMapper org.springframework.cloud.netflix.zuul.ZuulProxyAutoConfiguration.serviceRouteMapper)
└──<-──┘

Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

虽然这个错误可以在application启动类加上以下这段代码解决,
SpringApplication springApplication = new SpringApplication(SpringBootZuulFilterApplication.class);
springApplication.setAllowCircularReferences(Boolean.TRUE);
springApplication.run(args);

但是我不明白是因为哪里导致依赖循环了,serviceRouteMapper这个类也不知道是干嘛用的,请大家指教一下!谢谢

serviceRouteMapper是服务路由用的,参考如下例子

ServiceRouteMapper mapper = new ModuleServiceMapper();
DiscoveryClient discoveryClient = mock(DiscoveryClient.class);
ResponseLinksMapper responseLinksMapper = new ResponseLinksMapper(mapper, discoveryClient);
when(discoveryClient.getServices()).thenReturn(Collections.singletonList("service-module"));
responseLinksMapper.fillServices();
assertEquals("http://localhost:8080/api/service/entity", responseLinksMapper.fixLink("http://service-module/entity"));