title: How to return http 304 NOT_MODIFIED if Spring Rest gets a cache hit and If-Modified-Since header
body: <p>In an Spring Restful Server, is it possible to return a HTTP response with empty body and return code <code>304 NOT MODIFIED</code> if Spring hits the cache of an <code>@Cacheable GET</code> endpoint <strong>and</strong> <code>If-Modified-Since</code> header of the request is as old as the change date of the requested resource on the server?</p>
  
  <p>Of course, regarding the latter case with the appropriate cache http headers, I could implement that logic in the endpoint, but this seems both not to be very convenient and not compatible to the automatic caching annotations of Spring.</p>