最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Spring-cloud-eureka使用feign調(diào)用服務(wù)接口

 更新時間:2019年04月24日 09:44:46   作者:CarolLXW  
這篇文章主要為大家詳細(xì)介紹了Spring-cloud-eureka使用feign調(diào)用服務(wù)接口,具有一定的參考價值,感興趣的小伙伴們可以參考一下

Spring-cloud-eureka使用feign調(diào)用服務(wù)接口的具體方法,供大家參考,具體內(nèi)容如下

基于spring-boot 2.0以上版本完成的微服務(wù)架構(gòu)

pom.xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.5.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <spring-cloud.version>Finchley.SR1</spring-cloud.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>2.0.5.RELEASE</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-netflix-core</artifactId>
      <version>2.0.1.RELEASE</version>
      <classifier>sources</classifier>
      <type>java-source</type>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <version>2.0.5.RELEASE</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.4</version>
    </dependency>

    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.39</version>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.9.1</version>
    </dependency>
    
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.16.20</version>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
</build>

feignClient

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/*
 * @version 1.0 created by carolon 2018/9/25 17:18
 */
@FeignClient(value = "服務(wù)名")
public interface FeignClient {

  @RequestMapping(method = RequestMethod.POST, value = "接口地址")
  String sendDebugInfo(Object debugInfo);

}

finally

直接在需要的地方注入該client然后調(diào)用即可

@Autowired
private FeignService feignService;

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • java中字符進(jìn)行全角半角轉(zhuǎn)換示例代碼

    java中字符進(jìn)行全角半角轉(zhuǎn)換示例代碼

    全角:指一個字符占用兩個標(biāo)準(zhǔn)字符位置,而半角:指一字符占用一個標(biāo)準(zhǔn)的字符位置,在日常開發(fā)中經(jīng)常會遇到全角半角轉(zhuǎn)換的要求,下面這篇文章主要給大家介紹了關(guān)于java中字符進(jìn)行全角半角轉(zhuǎn)換的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下。
    2017-08-08
  • MyBatis類型處理器TypeHandler的作用及說明

    MyBatis類型處理器TypeHandler的作用及說明

    這篇文章主要介紹了MyBatis類型處理器TypeHandler的作用及說明,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2025-03-03
  • JAVA實現(xiàn)用戶抽獎功能(附完整代碼)

    JAVA實現(xiàn)用戶抽獎功能(附完整代碼)

    這篇文章主要給大家介紹了關(guān)于JAVA實現(xiàn)用戶抽獎功能的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • BigDecimal的加減乘除計算方法詳解

    BigDecimal的加減乘除計算方法詳解

    小編做題遇到了大數(shù)的精確計算,再次認(rèn)識了bigdecimal關(guān)于Bigdecimal意外的有許多小知識點(diǎn)和坑,這里特此整理一下為方便以后學(xué)習(xí),希望能幫助到其他的萌新
    2021-08-08
  • java字符串反轉(zhuǎn)示例分享

    java字符串反轉(zhuǎn)示例分享

    這篇文章主要介紹了將一個字符串進(jìn)行反轉(zhuǎn)或者字符串中指定部分進(jìn)行反轉(zhuǎn)的方法,大家參考使用吧
    2014-01-01
  • Java并發(fā)編程線程間通訊實現(xiàn)過程詳解

    Java并發(fā)編程線程間通訊實現(xiàn)過程詳解

    這篇文章主要介紹了Java并發(fā)編程線程間通訊實現(xiàn)過程詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-05-05
  • 談?wù)凧ava中Volatile關(guān)鍵字的理解

    談?wù)凧ava中Volatile關(guān)鍵字的理解

    volatile這個關(guān)鍵字可能很多朋友都聽說過,或許也都用過。在Java 5之前,它是一個備受爭議的關(guān)鍵字,因為在程序中使用它往往會導(dǎo)致出人意料的結(jié)果,本文給大家介紹java中volatile關(guān)鍵字,需要的朋友參考下
    2016-03-03
  • Spring多線程通過@Scheduled實現(xiàn)定時任務(wù)

    Spring多線程通過@Scheduled實現(xiàn)定時任務(wù)

    這篇文章主要介紹了Spring多線程通過@Scheduled實現(xiàn)定時任務(wù),@Scheduled?定時任務(wù)調(diào)度注解,是spring定時任務(wù)中最重要的,下文關(guān)于其具體介紹,需要的小伙伴可以參考一下
    2022-05-05
  • java中fork-join的原理解析

    java中fork-join的原理解析

    Fork/Join框架是Java7提供用于并行執(zhí)行任務(wù)的框架,是一個把大任務(wù)分割成若干個小任務(wù),今天通過本文給大家分享java中fork join原理,感興趣的朋友一起看看吧
    2021-04-04
  • 詳解java中保持compareTo和equals同步

    詳解java中保持compareTo和equals同步

    這篇文章主要介紹了詳解java中保持compareTo和equals同步的相關(guān)資料,需要的朋友可以參考下
    2017-03-03

最新評論

德兴市| 江山市| 荥阳市| 西华县| 阳曲县| 宜兰县| 奇台县| 如皋市| 陇川县| 石河子市| 马鞍山市| 虞城县| 临漳县| 陕西省| 沾化县| 丰原市| 南陵县| 交城县| 当涂县| 长汀县| 渑池县| 贡觉县| 铅山县| 庐江县| 宣威市| 塘沽区| 吴江市| 新沂市| 五原县| 新密市| 翁源县| 墨玉县| 万荣县| 佛坪县| 新闻| 鄂托克前旗| 泗水县| 恩施市| 四子王旗| 馆陶县| 三门峡市|