I want the capability to send the JSON list like List if the request Accept Header is of type application/json, but send it in a byte array(avro format) if the request Header is of type application/avro. This should be for the same REST endpoint like /something/employee. Can I have the same method but different return types, will Spring Boot look at the accept header and correctly decide on which method to call?
What should be the return type? Can it be a ResponseEntity without any type?
You can define your method to simply return a naked
ResponseEntityand check the value of theAcceptheader to determine what to return