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的更多相关文章

  1. springBoot Feign Hystrix

    1.引入依赖包 <!-- 引入关于 hystrix的依赖 --> <dependency> <groupId>org.springframework.cloud&l ...

  2. springboot feign too many bytes written executing POST

    解決办法: pom添加: <dependency><groupId>io.github.openfeign</groupId><artifactId>f ...

  3. Springboot feign 传递request信息

    基础实现 requestInterceptor 实现类中添加信息 public class NativeFeignConf { @Bean public RequestInterceptor getR ...

  4. springBoot Feign Hystrix Dashboard

    1.引入依赖 <!-- 引入关于 hystrix Dashboard的依赖 --> <dependency> <groupId>org.springframewor ...

  5. Solon 特性简集,相较于 Springboot 有什么区别?

    Solon 是一个类似Springboot的微型开发框架,也是一个不基于Servlet的开发框架.项目从2018年启动以来,参考过大量前人作品:历时两年,3500多次的commit:内核保持0.1m的 ...

  6. 不使用SpringBoot如何将原生Feign集成到Spring中来简化http调用

    在微服务架构中,如果使用得是SpringCloud,那么只需要集成SpringFeign就可以了,SpringFeign可以很友好的帮我们进行服务请求,对象解析等工作. 然而SpingCloud是依赖 ...

  7. springboot+cloud 学习(二)应用间通信Feign(伪RPC,实则HTTP)

    在微服务中,使用什么协议来构建服务体系,一直是个热门话题. 争论的焦点集中在两个候选技术:  RPC or Restful Restful架构是基于Http应用层协议的产物,RPC架构是基于TCP传输 ...

  8. Springboot中Feign的使用总结

    Feign是Webservice服务的客户端,创建接口+注解就可完成,实现简单 客户端通过@EnableFeignClients开启Feign的支持功能 @SpringBootApplication ...

  9. SpringBoot:使用feign调用restful服务时地址栏传参

    1.服务提供者(controller层) @GetMapping("/user/{id}") public ApiResult getById(@PathVariable(&quo ...

随机推荐

  1. Android stadio 模板 liveTemplate不管用

    今天自己弄了模板,发现不生效.后来才知道要在下面设置在哪里应用:如下图: Android satdio 制作自己的todo 有时候,别人都使用todo,使得自己个人的todo不好用了.那么怎么弄?自己 ...

  2. runloop的mode作用是什么?

    用来控制一些特殊操作只能在指定模式下运行,一般可以通过指定操作的运行mode来控制执行时机,以提高用户体验 系统默认注册了5个Mode kCFRunLoopDefaultMode:App的默认Mode ...

  3. 《数据结构与算法分析:C语言描述》复习——第六章“排序”——冒泡排序

    2014.06.17 01:04 简介: 冒泡排序是O(n^2)级别的交换排序算法,原理简单,属于必知必会的基础算法之一. 思路: 排序要进行N轮,每一轮从尾部逐个向前扫描,遇到逆序对就进行交换.确保 ...

  4. SQL语句中的换行符

    直接看示例(顺便注意下连接符) 示例1:Access INSERT INTO ZD_DJDCB (DJH,ZDSZ) VALUES ('150105101204JC00428', '北: 地块1' + ...

  5. Python 爬虫-豆瓣读书

    import requests from bs4 import BeautifulSoup def parse_html(num): headers = { 'User-Agent': 'Mozill ...

  6. eclipse集成python(Pydev插件安装)

    1.下载PyDev的压缩包,解压后会有features和plugins两个文件夹,将两个文件夹的内容拷贝到eclipse对应的文件夹中,重新启动eclipse 2.配置python 2.1打开ecli ...

  7. Python全栈 MySQL 数据库 (引擎、事物、pymysql模块、orm)

    ParisGabriel              每天坚持手写  一天一篇  决定坚持几年 为了梦想为了信仰    开局一张图     存储引擎(处理表的处理器)     基本操作:         ...

  8. [洛谷P4178]Tree

    题目大意:给一棵树,问有多少条路径长度小于等于$k$ 题解:点分治 卡点:无 C++ Code: #include <cstdio> #include <algorithm> ...

  9. [POI2015][bzoj4383] Pustynia [线段树优化建图+拓扑排序]

    题面 bzoj权限题传送门 luogu传送门 思路 首先,这个题目显然可以从所有小的点往大的连边,然后如果没环就一定可行,从起点(入读为0)开始构造就好了 但是问题来了,如果每个都连的话,本题中边数是 ...

  10. BZOJ3597 [Scoi2014]方伯伯运椰子 【二分 + 判负环】

    题目链接 BZOJ3597 题解 orz一眼过去一点思路都没有 既然是流量网络,就要借鉴网络流的思想了 我们先处理一下那个比值,显然是一个分数规划,我们二分一个\(\lambda = \frac{X ...