在做灰度发布验证的时候报错如下:
No qualifying bean of type 'com.netflix.loadbalancer.IRule' available:
expected single matching bean but found 2: grayRule,metadataAwareRule
当是觉得很奇怪,命名自己只定义了grayRule负载均衡策略规则,metadataAwareRule这个我代码中并没有。经过排查自己使用在pom中引入了Ribbon的包,该包默认会带负载均衡策略规则。导致有多个规则,从而报错。
<dependency>
<groupId>io.jmnarloch</groupId>
<artifactId>ribbon-discovery-filter-spring-cloud-starter</artifactId>
<version>2.1.0</version>
</dependency>
删除该包即可
删除后重新运行