1、maven
sb版本要比sc版本一样,或者比sc高
2、启动类
@EnableFeignClients(basePackages={"com.*"})public class WmsApplication {public static void main(String[] args) {SpringApplication.run(WmsApplication.class, args);} }3、使用案例
import org.springframework.cloud.openfeign.FeignClient;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import com.alibaba.fastjson.JSONObject;@FeignClient(url= "${test_url}",name="client")public interface TestClient { @RequestMapping(value="${test_token}",method= RequestMethod.GET) JSONObject getAccessToken(@RequestParam("grant_type") String grant_type,@RequestParam("appid") String appid,@RequestParam("secret") String secret); @RequestMapping(value="${test_getticket}",method= RequestMethod.GET) JSONObject getTicket(@RequestParam("access_token") String access_token,@RequestParam("type") String type); @RequestMapping(value="${test_oauth2_access_token}",method= RequestMethod.GET) String getOpenId(@RequestParam("appid") String appid,@RequestParam("secret") String secret,@RequestParam("code") String code,@RequestParam("grant_type") String grant_type); @RequestMapping(value="${test_menu_create}",method= RequestMethod.POST) JSONObject menuCreate(@RequestParam("access_token") String accessToken,@RequestBody(required=false)String jsonResult);}