功能介绍:动态代理的方式,简化请求其他服务的开发成本,更好得对请求地址组装、接受返回信息、返回参数解析等
Feign和OpenFeign区别:
OpenFeign实现了Feign的基础功能,同时支持springmvc的注解,比如@RequestMapping
功能实现
<!--openfeign依赖--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> # application.yml eureka: client: register-with-eureka: false service-url: defaultZone: http://eureka7001.com:7001/eureka/,http://eureka7002.com:7002/eureka/ //启动类 @SpringBootApplication @EnableFeignClients public class OrderFeignMain80 { public static void main(String[] args) { SpringApplication.run(OrderFeignMain80.class, args); } }
openFeign还可以配置日志打印、自定义拦截器和超时时间设置
比如:connectTimeout连接超时,readTimeout读取超时
参考地址: https://blog.csdn.net/qq_41539088/article/details/127681581
标签:Feign,openFeign,springcloud,args,eureka,超时,public From: https://www.cnblogs.com/zhougongjin/p/17106250.html