I need to read blob from database and show image as output is there any way I can do it? I can save image as blob in database but could not fetch it from database.
@RequestMapping(value = "/getlogo", method = { RequestMethod.GET,RequestMethod.POST })
public @ResponseBody BufferedImage getlogo(HttpSession session, @RequestBody ApplicationVO apo) throws IOException {
byte[] result=null ;
String appid=apo.getAppid();
logger.info("Application id :"+appid);
result=appService.getlogo(appid);
BufferedImage image=ImageIO.read(new ByteArrayInputStream(result));
return image;
}
this gives me error as : org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError)
Thank you