I have a controller method which should return some data. I'm wondering why despite it's GET
and marked with @ResponseBody
it's void
.
@ResponseBody
@RequestMapping(value = "/{id}/data", method = GET)
public void getData(....) { // < Question: how it can be void?
....
dataService.streamData(query); // < this method is also void
}
Question: What spring returns in this case? Is this method useless?
If a controller returns a null view name
, or declares a void return type
, Spring will attempt to infer the view name from the request URL.
It does this using an implementation of RequestToViewNameTranslator
, the default implementation of which is DefaultRequestToViewNameTranslator
complete info here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.