###1 服务端code 请直接参考这个链接文章 http://greenhtml.com/archives/eureka-zhilian.html
@RequestMapping("/user/InfoByCode")
@ResponseBody
@ApiOperation(value = "gateway 获取用户ID,用于放到header里面", httpMethod = "POST")
public UserInfoView InfoByCode(@RequestParam("code") String code) {
return UserInfoView.of(users.findFirstByInvitationCode(code));
}
###2 客户端调用直接指定url 请直接参考这个链接文章 http://greenhtml.com/archives/eureka-zhilian.html
@FeignClient(value = "THORUSER",url = "http://localhost:3331")
public interface UserClient {
@RequestMapping("/user/InfoByCode")
UserInfoView InfoByCode(@RequestParam("code") String code);
}
###3 这样就不经过eureka,直连微服务了。 请直接参考这个链接文章 http://greenhtml.com/archives/eureka-zhilian.html
、