Git Product home page Git Product logo

Comments (1)

daixinkai avatar daixinkai commented on August 15, 2024

测试环境和正式环境地址不一样怎么办,

不明白您指的是什么?
如果是 FeignClientAttribute 的 Url属性的话,个人只建议在开发阶段设置,方便调试,非要使用的话可以自定义:

   [AttributeUsage(AttributeTargets.Interface, Inherited = true, AllowMultiple = false)]
    public class CustomFeignClientAttribute : FeignClientAttribute
    {
        public CustomFeignClientAttribute(string name) : base(name)
        {
            Url = GetUrl(name);
        }

        static string GetUrl(string serviceName)
        {
            return "xxx";
        }

        public override string Url { get; set; }

    }

一旦 Url 设置为非null的话,服务发现就会失效了

最好的方式是实现 IServiceDiscovery 接口,可以自己读取配置文件,也可以基于Steeltoe二次开发.

from feign.net.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.