How to handle empty response in Spring RestTemplate
Use String instead of AuthenticationResponse. If you get an empty response, the String value will be empty. ResponseEntity<String> authenticateResponse = restTemplate.getForEntity(authenticateUrl, String.class); UPDATE: Check this link. I think this will fix your issue. ResponseEntity<Void> response = restTemplate.getForEntity(authenticateUrl,Void.class); Void body = response.getBody();