陋室铭

SpringCloud测试负载均衡

测试SpringCloud 服务负载均衡

1
2
3
4
5
6
7
8
@Autowired
private DiscoveryClient client;

@RequestMapping(value = "/add/{a}/{b}",method = RequestMethod.GET)
public String add(@PathVariable Integer a,@PathVariable Integer b){
System.out.println("host:"+client.getLocalServiceInstance().getHost()+" -----port:"+client.getLocalServiceInstance().getPort());
return a+b+" ------ host:"+client.getLocalServiceInstance().getHost()+" -----port:"+client.getLocalServiceInstance().getPort();
}
icefire wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!