RestTemplate also supports dealing with responses and mistakes correctly. You need to use the ResponseEntity course to get much more control above the reaction.
increase a major system to this course and annotate it https://hannaonid944507.idblogz.com/30802348/how-much-you-need-to-expect-you-ll-pay-for-a-good-spring-boot-security