In Servlet 3.0 specification, two servlets have different max file size can be created and worked fine.
@WebServlet(urlPatterns = { "/ureupload1" })
// 10MB
@MultipartConfig(maxFileSize = 1024 * 1024 * 10)
public class UploadServlet1 extends HttpServlet {
and
@WebServlet(urlPatterns = { "/ureupload2" })
// 30MB
@MultipartConfig(maxFileSize = 1024 * 1024 * 30)
public class UploadServlet2 extends HttpServlet {
If using Spring Boot Controller, @MultipartConfig seems to be not worked.
@Controller
@MultipartConfig(maxFileSize = 1024 * 1024 * 10)
public class UploadController1 {
@RequestMapping(value = "/upload1", method = RequestMethod.POST, consumes = "multipart/form-data")
public ModelAndView doPost(@RequestParam("file") MultipartFile file,
How do I create two controllers have different max file size?
EDIT:
Additional information: The following properties are in application.properties in order to set default max file size:
spring.http.multipart.max-file-size=30MB
See also: SpringBoot's @MultipartConfig maxFileSize not taking effect