天天看点

springboot openfeignclient

因为业务需要,暂时不需要springcloud。但是内部接口之间调用比较多,所以就在springboot里面加入了openfeign的模块。

1.在pom文件中的dependencies节点加入如下代码

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

                <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>           
<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>           
@Component
@FeignClient(name = "服务名字随便起一个就好了", url = "服务地址")