@Autowired
private ServletContext servletContext;
@RequestMapping (value = "/image_array/{fileName}", method = RequestMethod.GET)
public @ResponseBody
byte[] getImageAsByteArray(@PathVariable ("fileName") String fileName) throws IOException {
InputStream in = servletContext.getResourceAsStream("/WEB-INF/" + fileName + ".jpg");
return IOUtils.toByteArray(in);
}