I have a simple Spring rest webservice endpoint that exposes the result of a myqsl query as json:
@RestController
public class DbController {
@GetMapping(produces = APPLICATION_JSON_VALUE)
public List<Map<String, Object>> query() {
return crudRepository.queryForList(sql);
}
}
Problem: for large queries returning like 500k objects (means: rows), this consumes a lot of memory.
Is there any way I could write "partial" json results out to the response stream?