mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
集成 Feign 接口化管理 Http请求(如短信,支付,推送等)
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
package com.ruoyi.demo.feign;
|
||||
|
||||
import com.ruoyi.demo.feign.fallback.FeignTestFallback;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(name = "baidu",url = "http://www.baidu.com",fallback = FeignTestFallback.class)
|
||||
public interface FeignTestService {
|
||||
|
||||
@GetMapping("/s")
|
||||
String search(@RequestParam("wd") String wd);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.ruoyi.demo.feign.fallback;
|
||||
|
||||
|
||||
import com.ruoyi.demo.feign.FeignTestService;
|
||||
|
||||
public class FeignTestFallback implements FeignTestService {
|
||||
|
||||
@Override
|
||||
public String search(String wd) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
package com.ruoyi.demo.feign.fallback;
|
@ -0,0 +1 @@
|
||||
package com.ruoyi.demo.feign;
|
Reference in New Issue
Block a user