FeignTestService.java 721 B

123456789101112131415161718192021222324
  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. * @author Lion Li
  13. */
  14. @FeignClient(
  15. name = FeignTestConstant.BAIDU_NAME,
  16. url = FeignTestConstant.BAIDU_URL,
  17. fallback = FeignTestFallback.class)
  18. public interface FeignTestService {
  19. @GetMapping("/s")
  20. String search(@RequestParam("wd") String wd);
  21. }