麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

Spring Cloud feign

2019-11-10 20:36:44
字體:
供稿:網(wǎng)友

pom文件

導(dǎo)入包

<!-- sPRing-cloud-feign --> <dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-httpclient</artifactId> <version>${feign-httpclient.version}</version> </dependency> <dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-core</artifactId> <version>${feign-httpclient.version}</version> </dependency> <dependency> <groupId>com.netflix.feign</groupId> <artifactId>feign-gson</artifactId> <version>${feign-httpclient.version}</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-config</artifactId> <version>1.2.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter</artifactId> <version>1.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-client</artifactId> <version>1.2.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> <version>1.2.4.RELEASE</version> </dependency> <!--調(diào)用其他微服務(wù)--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-ribbon</artifactId> <version>1.2.5.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-feign</artifactId> <version>1.2.5.RELEASE</version> </dependency> <!-- spring-cloud-feign end -->

寫一個接口 FeignInterface

import org.springframework.cloud.netflix.feign.FeignClient;import org.springframework.http.ResponseEntity;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import java.util.List;/** * Created by Administrator on 2017/2/5. */@FeignClient(name="ribbonserver", url="http://localhost:8080")public interface FeignInterface { @RequestMapping(value = "/baseBackStage/index", method = RequestMethod.GET) ResponseEntity<String> index();}

新建FeignController

import feign.Feign;import feign.Logger;import feign.codec.Decoder;import feign.gson.GsonDecoder;import io.swagger.annotations.Api;import io.swagger.annotations.ApiImplicitParams;import io.swagger.annotations.ApiOperation;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.ResponseEntity;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RestController;import java.util.Base64;import java.util.List;@Api(value = "Feign測試使用",description = "Feign測試使用")@RequestMapping("/feigntest")@RestControllerpublic class FeignController { @Autowired FeignInterface feign; @ApiOperation(value = "Feign主測試使用") @ApiImplicitParams({}) @RequestMapping(value = "/index" ,method = RequestMethod.GET) public ResponseEntity<String > helloWord() { System.out.println("test Return================1"); Decoder decoder = new GsonDecoder(); ResponseEntity<String> responseEntity = feign.index(); String contributors = responseEntity.getBody(); System.out.println("test Return=="+contributors); return ResponseEntity.ok("hello word"); }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 狠狠操精品视频 | 姑娘第四集免费看视频 | 一区国产在线观看 | 看免费av | 日本羞羞影院 | 日韩色视频 | 一本色道久久综合亚洲精品小说 | 国产一级毛片高清 | 久久久无码精品亚洲日韩按摩 | 国产精品99久久免费观看 | 国产噜噜噜噜久久久久久久久 | 午夜视频大全 | 亚洲国产精品二区 | 色综合久久久久久 | 高清一区二区在线观看 | 成人三级电影网站 | 日本精品网 | 成人一级视频在线观看 | 中文字幕在线永久 | 永久av在线免费观看 | 永久久久 | 欧美黄 片免费观看 | 国产亚洲精品久久久久久久久久 | 亚洲一级电影在线观看 | 中国美女一级黄色大片 | 日韩精品久久久久久久电影99爱 | 日韩激情 | 日韩欧美电影一区二区三区 | 成人国产精品久久久 | 久久伊人国产精品 | 久久看免费视频 | 亚洲综人网 | 在线高清中文字幕 | 蜜桃视频在线免费播放 | 宅男噜噜噜66国产免费观看 | 国产激情网 | 黄色免费电影网址 | 久久久久久久久久亚洲 | 色网站免费观看 | mmmwww| 国产国语毛片 |