springBoot Feign
1.引入依赖包
<!-- 引入关于 eureka-server的依赖 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
2.主函数
@EnableEurekaClient
@EnableFeignClients
3.创建feign配置文件
package com.example.eurekafeignclient.config; import feign.Retryer;
import org.springframework.context.annotation.Configuration; import java.util.concurrent.TimeUnit; @Configuration
public class feignConfig {
public Retryer feignRetryer() {
return new Retryer.Default(100, TimeUnit.SECONDS.toMillis(1), 5);
}
}//end
4.创建接口
package com.example.eurekafeignclient; import com.example.eurekafeignclient.config.feignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping; @FeignClient(value = "eureka-client", configuration = feignConfig.class)
@Service
public interface imp_eurekaClientFeign {
@GetMapping(value = "/hello")
String hello11();
}//end
5.创建controller调用
package com.example.eurekafeignclient.controller; import com.example.eurekafeignclient.imp_eurekaClientFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class clientController {
@Autowired
imp_eurekaClientFeign imp_eurekaClientFeign_;
@RequestMapping("/hello")
public String hello() {
return imp_eurekaClientFeign_.hello11();
}
}
springBoot Feign的更多相关文章
- springBoot Feign Hystrix
1.引入依赖包 <!-- 引入关于 hystrix的依赖 --> <dependency> <groupId>org.springframework.cloud&l ...
- springboot feign too many bytes written executing POST
解決办法: pom添加: <dependency><groupId>io.github.openfeign</groupId><artifactId>f ...
- Springboot feign 传递request信息
基础实现 requestInterceptor 实现类中添加信息 public class NativeFeignConf { @Bean public RequestInterceptor getR ...
- springBoot Feign Hystrix Dashboard
1.引入依赖 <!-- 引入关于 hystrix Dashboard的依赖 --> <dependency> <groupId>org.springframewor ...
- Solon 特性简集,相较于 Springboot 有什么区别?
Solon 是一个类似Springboot的微型开发框架,也是一个不基于Servlet的开发框架.项目从2018年启动以来,参考过大量前人作品:历时两年,3500多次的commit:内核保持0.1m的 ...
- 不使用SpringBoot如何将原生Feign集成到Spring中来简化http调用
在微服务架构中,如果使用得是SpringCloud,那么只需要集成SpringFeign就可以了,SpringFeign可以很友好的帮我们进行服务请求,对象解析等工作. 然而SpingCloud是依赖 ...
- springboot+cloud 学习(二)应用间通信Feign(伪RPC,实则HTTP)
在微服务中,使用什么协议来构建服务体系,一直是个热门话题. 争论的焦点集中在两个候选技术: RPC or Restful Restful架构是基于Http应用层协议的产物,RPC架构是基于TCP传输 ...
- Springboot中Feign的使用总结
Feign是Webservice服务的客户端,创建接口+注解就可完成,实现简单 客户端通过@EnableFeignClients开启Feign的支持功能 @SpringBootApplication ...
- SpringBoot:使用feign调用restful服务时地址栏传参
1.服务提供者(controller层) @GetMapping("/user/{id}") public ApiResult getById(@PathVariable(&quo ...
随机推荐
- MyEclipse - 问题集 - maven update project 后,项目jdk的版本变化
解决方法: 进入maven安装根目录,conf/settings.xml <profiles> <profile> <id>jdk-1.7</id> & ...
- UIView和CALayer是什么关系?
UIView显示在屏幕上归功于CALayer,通过调用drawRect方法来渲染自身的内容,调节CALayer属性可以调整UIView的外观,UIView继承自UIResponder,比起CALaye ...
- 【Noise and Probabilistic Target】林轩田机器学习基石
http://beader.me/mlnotebook/section2/noise-and-error.html 上面这个日志总结的已经很好了.这一章的内容,在后面具体的算法中cost functi ...
- Python 模块:random 随机数生成
Python中的random模块用于生成随机数. 使用该模块之前需要 import random 几个常用的函数用法: 1.random.random 函数原型: random.random() 用于 ...
- ASP.NET Core [4]: Authentication(笔记)
原文连接:http://www.cnblogs.com/RainingNight/p/authentication-in-asp-net-core.html 在现代应用程序中,认证已不再是简单的将用户 ...
- Python 第一周编程作业
一. 编程题 1. 结合turtle库使用手册,读懂下列代码,并在jupyter编译器中运行观察结果: 依次分析下代码: 第一行 通过保留字import引用了Python中用于绘制图形的turtl ...
- python作业:购物车(第二周)
一.作业需求: 1.启动程序后,输入用户名密码后,如果是第一次登录,让用户输入工资,然后打印商品列表 2.允许用户根据商品编号购买商品 3.用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒 4 ...
- ALPHA(10)
目录 组员情况 组员1(组长):胡绪佩 组员2:胡青元 组员3:庄卉 组员4:家灿 组员5:凯琳 组员6:翟丹丹 组员7:何家伟 组员8:政演 组员9:黄鸿杰 组员10:刘一好 组员11:何宇恒 展示 ...
- OpenFlow-Enaling innvation in Campus Networks
OpenFlow-Enaling innvation in Campus Networks 出现问题 背景 Networks have become part of the critical infr ...
- hadoop2.5.2学习及实践笔记(一)—— 伪分布式学习环境搭建
软件 工具:vmware 10 系统:centOS 6.5 64位 Apache Hadoop: 2.5.2 64位 Jdk: 1.7.0_75 64位 安装规划 /opt/softwares ...