springBootVersion = “2.6.1”
springCloudVersion = “2021.0.0”
问题描述:
消费者模块通过openfeign调用提供者,消费者模块启动报错
异常日志:
Factory method ‘ribbonLoadBalancer’ threw exception; nested exception is java.lang.IllegalArgumentException: value cannot be empty
解决方案:
//SpringCloud Feign在Hoxton.M2 RELEASED版本之后不再使用Ribbon而是使用spring-cloud-loadbalancer implementation "org.springframework.cloud:spring-cloud-starter-loadbalancer" //导入 spring-cloud-loadbalancer后nacos中 spring-cloud-starter-netflix-ribbon会与它冲突,造成loadbalanc包失效;或者添加配置yml关闭ribbon implementation('com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery'){ exclude group: 'org.springframework.cloud', module: 'spring-cloud-starter-netflix-ribbon' }
不使用ribbon(默认启动)
spring: cloud: nacos: loadbalancer: ribbon: enabled: false
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)