当前位置:网站首页>Openfeign service call
Openfeign service call
2022-04-23 03:02: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/04/202204220633252075.html
边栏推荐
- Android high-level interview must ask: overall business and project architecture design and reconstruction
- 基于ele封装下拉菜单等组件
- Practical combat of industrial defect detection project (II) -- steel surface defect detection based on deep learning framework yolov5
- HLS / chisel uses CORDIC hyperbolic system to realize square root calculation
- The space between the left and right of the movie ticket seats is empty and cannot be selected
- The express project changes the jade template to art template
- [software testing] understand the basic knowledge of software testing
- The way to conquer C language
- How to write the expected salary on your resume to double your salary during the interview?
- Basic workflow of CPU
猜你喜欢
Introduction to ACM [inclusion exclusion theorem]
The interface request takes too long. Jstack observes the lock holding
Dynamic sequence table + OJ
[hcip] detailed explanation of six LSAS commonly used by OSPF
leangoo脑图-共享式多人协作思维导图工具分享
Linux redis - redis database caching service
树莓派开发笔记(十二):入手研华ADVANTECH工控树莓派UNO-220套件(一):介绍和运行系统
Kubernetes - Introduction to actual combat
Liunx foundation - zabbix5 0 monitoring system installation and deployment
How to write the expected salary on your resume to double your salary during the interview?
随机推荐
樹莓派開發筆記(十二):入手研華ADVANTECH工控樹莓派UNO-220套件(一):介紹和運行系統
Huawei machine test question -- deformation of hj53 Yang Hui triangle
Classification of technology selection (2022)
Win view port occupation command line
基于多态的职工管理系统源码与一些理解
tf. keras. layers. Timedistributed function
Golden nine silver ten interview season, you are welcome to take away the interview questions (with detailed answer analysis)
Notes sur le développement de la tarte aux framboises (XII): commencer à étudier la suite UNO - 220 de la tarte aux framboises de contrôle industriel advantech (i): Introduction et fonctionnement du s
OCR recognition PDF file
Shell script learning notes - regular expressions
In redis cluster, the master node fails, and the IP changes after the master-slave switch. The client does not need to deal with it
L2-006 樹的遍曆(中後序確定二叉樹&層序遍曆)
Thoughts on the 2022 national network security competition of the national secondary vocational group (only one idea for myself) - network security competition questions (7)
Close the computer port
[Euler plan question 13] sum of large numbers
The express project changes the jade template to art template
Chapter VII project communication management of information system project manager summary
Navicat premium import SQL file
Navicat failed to connect to Oracle Database: cannot load OCI DLL, 87: instant client package is
Source code and some understanding of employee management system based on polymorphism