FeignTestService.java 873 B

123456789101112131415161718192021222324252627
  1. package com.ruoyi.demo.feign;
  2. import com.ruoyi.demo.feign.constant.FeignTestConstant;
  3. import com.ruoyi.demo.feign.fallback.FeignTestFallback;
  4. import org.springframework.cloud.openfeign.FeignClient;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.RequestParam;
  7. /**
  8. * feign测试service
  9. * 规范接口 Service 无感调用
  10. * 常量管理请求路径 更加规范
  11. * 自定义容错处理 安全可靠 (需自行配置熔断器)
  12. * 增加 feign 的目的为使 http 请求接口化
  13. *
  14. * @author Lion Li
  15. * @deprecated 由于使用人数较少 决定与 3.4.0 版本移除
  16. */
  17. @FeignClient(
  18. name = FeignTestConstant.BAIDU_NAME,
  19. url = FeignTestConstant.BAIDU_URL,
  20. fallback = FeignTestFallback.class)
  21. public interface FeignTestService {
  22. @GetMapping("/s")
  23. String search(@RequestParam("wd") String wd);
  24. }