当前位置:网站首页>Take you hand in hand to build feign with idea

Take you hand in hand to build feign with idea

2022-07-07 23:38:00 Rain fish in summer


Preface

At present, micro services have become the mainstream , This article will take you by hand idea structure feign.


One 、feign What is it? ?

feign yes spring cloud Call framework of service consumer side in , simply , There are many services in microservices , It can be done by feign To call , Instead of calling directly .

Two 、 Specific operation steps

1. newly build feign modular

As shown in the figure below ,
 Insert picture description here
 Insert picture description here
 Insert picture description here
Name the module ,feign
 Insert picture description here

2. Modify the configuration file

The parent file introduces the new feign modular ,feign Import parent file , Remember to refresh and take effect  Insert picture description here
introduce feing rely on , Also register to eureka The server
 Insert picture description here

3. Run the project

Simply write a test class , And add corresponding notes
 Insert picture description here
Start project , Include eureka、web、feign,
 Insert picture description here
Access in a browser , You'll find that ,web、feign Have been registered to eureka in ,
 Insert picture description here
Request in browser , as follows , success
 Insert picture description here
I'm afraid you don't understand , Let me sort out the logic with you again , The original request was a direct request , Now it becomes a request feign, adopt feign To request .


summary

Follow the above steps , You must have learned to use idea structure feign. If you have read this article , Be a good person and praise , It's not easy to write , If the article is flawed , Please write a comment , Make a friend and give a compliment .

原网站

版权声明
本文为[Rain fish in summer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130557395957.html