spring mvc显示图片(个人记录)

@ResponseBody
@RequestMapping(value = {"/",""}, method = RequestMethod.GET, produces = MediaType.IMAGE_JPEG_VALUE)
public byte[] getImageFormDB(@RequestParam Long picId) {
Image image = imageService.load(picId);
return image.getFile();
}

原文地址:https://www.cnblogs.com/ly-radiata/p/5411232.html