当前位置:网站首页>Openfeign service call
Openfeign service call
2022-04-23 22:10:00 【Leon_ Jinhai_ Sun】
# 1. Service invocation method introduces dependency OpenFeign rely on
<!--Open Feign rely on -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
# 2. Add comments to the entry class to open OpenFeign Support
@SpringBootApplication
@EnableFeignClients
public class Users9999Application {
public static void main(String[] args) {
SpringApplication.run(Users9999Application.class, args);
}
}
# 3. Create a client call interface
//value Property to specify : Call service name
@FeignClient("PRODUCTS")
public interface ProductClient {
@GetMapping("/product/findAll") // Write the service call path
String findAll();
}
# 4. Use feignClient The client object invokes the service
// Inject client objects
@Autowired
private ProductClient productClient;
@GetMapping("/user/findAllFeignClient")
public String findAllFeignClient(){
log.info(" By using OpenFeign Component invokes goods and services ...");
String msg = productClient.findAll();
return msg;
}
# 5. Access and test services
- http://localhost:9999/user/findAllFeignClient
版权声明
本文为[Leon_ Jinhai_ Sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/113/202204232157393447.html
边栏推荐
- [LeetCode][Golang] 647. 回文子串
- 基于RestTemplate的服务调用
- 修改服务的默认负载均衡策略
- Cvpr2022 | efficient pre training based on knowledge distillation
- OpenFeign的细节展示
- Download, install and configure Huawei integrated development environment ide deveco device tool
- Vscode may not establish connection to "XXX"
- static关键字及应用
- Mobile phone uses SSH to log in nanopi M1 summary (this time on the same LAN)
- Database Experiment 2 data query
猜你喜欢
MySQL back to table
Idea import a project
Unity制作一个小星球
延时消息常见实现方案
Introduction to hystrix and implementation of server fuse
通过OpenFeign传递对象类型参数
leetcode 2223 — 构造字符串的总得分和
Ribbon组件基本介绍和使用
1. Summary of GPIO control of nanopi M1 (Quanzhi H3) based on wiringpi
Hirschmann display maintenance computer controller repair
随机推荐
Online Excel to CSV tool
Ribbon组件基本介绍和使用
3、 Zygote start process
Unity makes a small planet
LabVIEW修改应用程序窗口外观
21. Basic usage of MariaDB
consul server 服务注册中心安装
Leaf Smecta
Sqlserver edits data in the query interface (similar to Oracle's edit and ROWID)
Hystrix简介和服务端熔断的实现
QT QML component library records owned by QML except basic components
Ensuring the quality of living materials and food safety in Shanghai
Consumer server service registry installation
将OSS上的图片转换成Base64编码
hystrix dashboard的使用
C winfrom DataGridView click on the column header can not automatically sort the problem
Consumer turns on health monitoring check
OpenFeign的细节展示
Spellman high voltage power supply maintenance xrm50p50x3768 power supply maintenance pcm70n120x451
Renesas ide: CS + for CC download, installation and basic use