springboot注入request,上传文件request无法转换成MultipartHttpServletRequest

springboot项目request注入以后,百度富文本上传文件失败,发现request不能转换成MultipartHttpServletRequest,request作为参数就行了 ,与application.properties配置multipart.enabled=true无关,与没有common-io.jar也无关,与配置CommonsMultipartResolver无关

@RequestMapping(value = "ueditorController")
    public void ueditor_config(HttpServletRequest request) {
        response().setHeader("Content-type", "text/html;charset=UTF-8");
        response().setContentType("text/html;charset=utf-8");
        try {
            String rootPath = ResourceUtils.getURL("classpath:").getPath();
            String exec = new ActionEnter(request, rootPath + "/static/").exec(file_upload_path);
            PrintWriter writer = response().getWriter();
            writer.write(exec);
            writer.flush();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

猜你喜欢

转载自blog.csdn.net/cgf_01/article/details/104768983
今日推荐