DemoFeign.java 1011 B

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