SpringCould跨域调用服务端已经配好的情况下最主要需要注意客户端的调用流程,主要有两点:
1,在客户端Controller添加@RequestMapping,@RequestMapping,@ResponseBody注解
@RequestMapping(value = “”, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(httpMethod = “POST”, value = “”)
@ResponseBody
2,在客户端Service添加@FeignClient,@RequestMapping注解,Feign客户端里面配置熔断
@FeignClient(name = “”,fallback = ServiceFallback.class)
@RequestMapping(value = “”, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
springCloud跨域调用服务
最新推荐文章于 2024-06-20 20:27:35 发布