DemoFeign.java 972 B

123456789101112131415161718192021222324
  1. package com.yihu.jw.fegin;
  2. import com.yihu.jw.fegin.fallbackfactory.DemoFeignFallbackFactory;
  3. import com.yihu.jw.common.CommonContants;
  4. import org.springframework.cloud.netflix.feign.FeignClient;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RequestMethod;
  7. import org.springframework.web.bind.annotation.RequestParam;
  8. /**
  9. * Created by chenweida on 2017/5/10.
  10. */
  11. @FeignClient(
  12. name = CommonContants.svr_base // name值是eurika的实例名字
  13. // ,fallback = PatientFeginFallback.class// fallback是请求超时或者错误的回调函数
  14. ,fallbackFactory = DemoFeignFallbackFactory.class
  15. // ,configuration = //可以配置当个fegin的配置 例如禁用单个feign的hystrix
  16. )
  17. public interface DemoFeign {
  18. @RequestMapping(value = "/demo/findByCode", method = RequestMethod.GET)
  19. String findByCode(@RequestParam(value = "code", required = true) String code);
  20. }