Search code examples
springresttemplate

@Nullable over Spring's RestTemplate's PostForObject method


What does this Annotation @Nullable over postForObject's method mean in RestTemplate?

I want to clarify if the custom object I am getting can ever be null?

HttpEntity<CustResponse > request = new HttpEntity<>(custRequest, headers);
CustResponse custResponse = restTemplate.postForObject("url", request, CustResponse .class);

Can custResponse ever be null?


Solution

  • Looks like this annotation is used to avoid any auto generated warnings from code analyzer like Find Bugs. Similar question was posted here @Nullable annotation usage