org.springframework.web.client.RestTemplate
@ResponseBody
@PostMapping(value = "/page" , produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> page(@RequestParam String name) {
// callanother server / port on same host
final String url = String.format("http://localhost:%d/basic/post", port);
RestTemplate restTemplate = new RestTemplate();
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
final Data input = new Data();
input.setName(name);
final Gson gson = new Gson();
final String payload = gson.toJson(input);
final HttpEntity<String> request = new HttpEntity<String>(payload, headers);
final ResponseEntity<Data> responseEntity = restTemplate.postForEntity(url,
request, Data.class, headers);
final String result = responseEntity.getBody().getName();
return ResponseEntity.status(HttpStatus.OK).body(result);
}
GenerationType
AUTO
docker container run --rm -v $(pwd)/logs:/work/logs:rw -u $(id -u ${USER}):$(id -g ${USER}) $IMAGE command
docker help run
--network network Connect a container to a network
добавил ":"
если помогло - отметьте решением