首页 > 其他 > 详细

feign的初步使用

时间:2018-04-10 15:03:54      阅读:160      评论:0      收藏:0      [点我收藏+]
1.添加依赖包
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>9.6.0</version>
</dependency>

2.编写一个接口
public interface MyFeignInterFace {

@RequestLine("GET /call")
public String hello();

}
// 注意 GET / 之间要有空格

3 简单的调用
/**

  • @param args
    */
    public static void main(String[] args) {
    MyFeignInterFace fg=Feign.builder().target(MyFeignInterFace.class,"http://localhost:8080");
    String str=fg.hello();
    System.out.println(str);
    }
    // 地址为自己开启的项目地址 (GET /调用的链接名)

feign的初步使用

原文:http://blog.51cto.com/13696334/2096469

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!