Can I configure a @FeignClient url using a properties/yml file?

后端 未结 2 1612
忘掉有多难
忘掉有多难 2020-12-08 04:50

My goal is to create a strategy of different steps to get from a point-to-point communication between 2 components to a \"full blown netflix\" style of communication using e

相关标签:
2条回答
  • 2020-12-08 05:15

    It can be done with a "serviceId" instead of a "url". E.g.

    @FeignClient("foo")
    interface Client { ... }
    

    and

    foo.ribbon.listOfServers: localhost:9000
    

    e.g. see http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-ribbon-without-eureka for docs.

    0 讨论(0)
  • 2020-12-08 05:24

    This can be done like this:

    @FeignClient(name="fd-mobileapi-service",url="${fdmobile.ribbon.listOfServers}")
    

    Where fdmobile.ribbon.listOfServers : value is a property in application.properties.

    I have tested it and it is working.

    0 讨论(0)
提交回复
热议问题