when i add image on admin page for a product . it is uploading successfully and uploaded image is reflected (saves) on correct folder
But when i run user portal and sees products . The product images are not showing up
@RequestMapping(value = "/add", method = RequestMethod.POST)
public String addBookPost(@ModelAttribute("book") Book book, HttpServletRequest request) {
bookService.save(book);
MultipartFile bookImage = book.getBookImage();
try {
byte[] bytes = bookImage.getBytes();
String name = book.getId() + ".png";
BufferedOutputStream stream = new BufferedOutputStream(
new FileOutputStream(new File("src/main/resources/static/image/book/" + name)));
stream.write(bytes);
stream.close();
} catch (Exception e) {
e.printStackTrace();
}
return "redirect:bookList";
}