springboot 整合 feign

2020-10-23  本文已影响0人  急中生智的言灵之书

启动文件

@EnableFeignClients(basePackages = {"com.sie.saaf.activity.seckill.model.inter" })

调用接口

package com.sie.saaf.activity.seckill.model.inter;

import org.springframework.cloud.netflix.feign.FeignClient;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name ="1006-SAAF-BASE-SERVER")

public interface IFeign{

@RequestMapping(value ="/baseLoginService/login", method = RequestMethod.POST)

StringbaseLoginServiceLogin(@RequestParam("params") String params);

}

yml文件
feign:

    httpclient:

        enabled: true

pom.xml

<dependency>

            <groupId>org.springframework.cloud</groupId>

            <artifactId>spring-cloud-starter-openfeign</artifactId>

            <version>2.1.3.RELEASE</version>

</dependency>

上一篇 下一篇

猜你喜欢

热点阅读