private void addServiceData(JsonGenerator json, ServiceInstance localService) throws IOException { json.writeObjectFieldStart("origin"); json.writeStringField("host", localService.getHost()); json.writeNumberField("port", localService.getPort()); json.writeStringField("serviceId", localService.getServiceId()); if (this.properties.isSendId()) { json.writeStringField("id", this.context.getId()); } json.writeEndObject(); }
@ApiOperation(value = "/add", notes = "求和") @RequestMapping(value = "/add", method = RequestMethod.GET) public Integer add( @ApiParam(required = true, name = "a", value = "") @RequestParam Integer a, @ApiParam(required = true, name = "b", value = "") @RequestParam Integer b) { ServiceInstance instance = client.getLocalServiceInstance(); Integer r = a + b; logger.info( "/add, host:" + instance.getHost() + ", service_id:" + instance.getServiceId() + ", result:" + r); return r; }