Estou configurando, para que o Spring "cuide dele", ñ sei se é possivel, contudo consegui configura-lo no pom e no xml.
Por enquanto, só quero que apareça o caminho da imagem no console.
javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
spring-context.xml
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="1000000" />
</bean>
<mvc:default-servlet-handler />
no Controller
@PostMapping("/value")
public String upload(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
MultipartFile multipartFile = multipartRequest.getFile("file");
System.out.println(multipartFile.getOriginalFilename());
return "redirect:/lista";
}