'Feign function @PostMapping call to common function

I have a case where I need to call

  • 2 different endpoints with
  • 2 different host and
  • 2 different configuration file as credentials are different for both host

by making call to same function so that a common logic can be written to run for two different endpoints, how can it can be achieved using feign client java?

Host for this is: https://abcstg.abc.3abc.net

@PostMapping(value = "/getABCStatus/V1", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)

ResponseEntity<StatusResponseDto> handleDelete(StatusRequestDto dto);

Host for this is: https://xyzstg.xyz.3xyz.net

 @PostMapping(value = "/getstatusXYZ/V1", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)

 ResponseEntity<StatusResponseDto> handleDelete(StatusRequestDto dto);

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source