SpringBoot集成Feign组件调用第三方接口【手把脚教学】

本文详细介绍了如何在SpringBoot项目中集成Feign组件,以调用第三方接口。通过POM文件引入相关依赖,设置项目结构,包括启动类、yml配置、RMI模块代码和Controller调用代码。特别指出,引入feign-httpclient是为了管理连接,提高性能,解决默认HttpURLConnection无连接池的问题。

SpringBoot集成Feign组件调用第三方接口

一、 POM文件引入

  • 版本控制
    <properties>
        <java.version>1.8</java.version>
        <!-- openfeign -->
        <fegin.version>2.2.6.RELEASE</fegin.version>
        <fegin.http.client.version>11.0</fegin.http.client.version>
    </properties>
  • 依赖管理
    <dependencyManagement>
        <dependencies>            
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-openfeign</artifactId>
                <version>${fegin.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/io.github.openfeign/feign-httpclient -->
            <dependency>
                <groupId>io.github.openfeign</groupId>
                <artifactId>feign-httpclient</artifactId>
                <version>${fegin.http.client.version}</version>
            </dependency>
        </dependencies>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值