Specifying route URI in Spring Cloud Gateway Configuration

╄→尐↘猪︶ㄣ 提交于 2020-05-14 02:44:48

问题


Here is the yml for spring cloud gateway. I want to write URI without load balancing. But as I'm using Eureka, I don't think hardcoding something like "localhost:6678" is a good idea. I would like to specify the service name, without the lb prefix. Any way to write it ?

  spring:
  cloud:
    gateway:
      routes:
      - id: before_route
        uri: lb://hello-service

I'm seeing this on the console when I run the gateway:

You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.

What is the official alternative of Ribbon? How can I enable it in my project instead of Ribbon?

Edit: I'm trying to avoid load balancing for now because of poor performance. Without lb I'm getting my request served within 150ms whereas lb makes it 500ms+

Thanks in advance!

来源:https://stackoverflow.com/questions/61144845/specifying-route-uri-in-spring-cloud-gateway-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!