当前位置:网站首页>Analysis of fegin
Analysis of fegin
2022-06-22 21:46:00 【InfoQ】
One 、Feign
Basic concepts
- Feign yes Netflix Developed declarative 、 templated HTTP client , Feign Can help us more quickly 、 Call... Gracefully HTTP API.\
- Feign Support multiple annotations , for example Feign Own notes or JAX-RS Annotations etc. .\
- Spring Cloud Yes Feign Enhanced , send Feign Support Spring MVC annotation , And integrated Ribbon and Eureka, So that Feign It is more convenient to use .\
- Spring Cloud Feign Is based on Netflix feign Realization , Integrated Spring Cloud Ribbon and Spring Cloud Hystrix, In addition to providing the powerful functions of both , It also provides a declarative Web How the service client is defined .\
- Spring Cloud Feign Help us define and implement the definition of dependent service interfaces . stay Spring Cloud feign Under the realization of , Just create an interface and configure it with annotations , The interface binding of the service provider can be completed , Simplified in use Spring Cloud Ribbon Encapsulate the development amount of the service invocation client .
Two 、 Implement service calls
1、 Add on the caller side pom rely on
<!-- The service call -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
2、 Start the class to add comments
@EnableFeignClients
3、 Create remote call packages and interfaces
package com.guli.statistics.client;
@Component
@FeignClient("guli-ucenter")
public interface UcenterClient {
/**
* Be careful : It must be written as @PathVariable("day"), In parentheses "day" It can't be less
* @param day
* @return
*/
@GetMapping(value = "/admin/ucenter/member/count-register/{day}")
public R registerCount(@PathVariable("day") String day);
}
4、 Call microservices
@Autowired
private UcenterClient ucenterClient;
@Transactional(rollbackFor = Exception.class)
@Override
public void createStatisticsByDay(String day) {
// Delete the existing statistics object
...
// Get statistics
Integer registerNum = (Integer) ucenterClient.registerCount(day).getData().get("countRegister");
...
// Create statistics object
...
}
5、Swagger test
3、 ... and 、 Test load balancing
边栏推荐
- Oracle数据库中文字符串和英文字符串的截取不同
- Differences between watch, computed and methods
- Jerry's music mode obtains the directory of playing files [chapter]
- Lesson 014-15: string (see lesson 27-32 of the new version of little turtle) | after class test questions and answers
- 鸿蒙第三次培训
- HarmonyOS应用开发培训第二次
- Introduce sparse activation mechanism! Uni perceiver MOE significantly improves the performance of generalist model
- 第028讲:文件:因为懂你,所以永恒 | 课后测试题及答案【无标题】
- 查询es分页下标超过1万
- How swiftui simulates the animation effect of view illumination increase
猜你喜欢

大势智慧创建倾斜模型和切割单体化

第026讲:字典:当索引不好用时2 | 课后测试题及答案

ByteDance proposes a lightweight and efficient new network mocovit, which has better performance than GhostNet and mobilenetv3 in CV tasks such as classification and detection

杰理之外挂 4M 的 flash 在 PC 上查看大小只有 1M 的处理方法【篇】

鸿蒙第三次培训
![List of outstanding talents: no crystal vibration, one drag, eight burn and upgrade [chapter]](/img/6c/333bc95fe390234d3d06043e4bded1.png)
List of outstanding talents: no crystal vibration, one drag, eight burn and upgrade [chapter]

查询es分页下标超过1万

Redis learning notes

Lesson 033: exception handling: you can't always be right 2 | after class test questions and answers

Adblock屏蔽百度热搜
随机推荐
Kali2021 installing the rtl8188gu wireless network card [tl-wn726n] driver
Fegin的解析
分享insert into select遇到的死锁问题(项目实战)
Redis usage scenario sharing (project practice)
70 root cause analysis Oracle database sudden performance problems, who will take the blame
RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemmStridedBatched( ha
Install MySQL in ECS (version 2022)
Simulated 100 questions and simulated examination of hoisting machinery command examination in 2022
Android kotlin SP DP to PX
2022年山东省安全员C证考试试题模拟考试平台操作
第014-15讲:字符串 (见小甲鱼新版27讲-32讲)| 课后测试题及答案
2022 a special equipment related management (elevator) examination questions and simulation examination
Correspondence between int and char in C language
基于C语言开发工资管理系统 课程论文+源码及可执行exe文件
92 match for several_ Recognize SQL write example
Laravel+ pagoda planning task
localStorage、sessionStorage 和 cookie 的区别大总结
第018讲:函数:灵活即强大 | 课后测试题及答案
las 点云创建网格
LeetCode#20. Valid parentheses