之前看的资料都是去年甚至更远的,1.0版本,1.4版本,之后是找到了用于2.4.5版本的配置,也是适用于我目前的项目
第一种方法:
package com.haiyisoft.loveLifeWeb.config;
import javax.servlet.MultipartConfigElement;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;
import com.haiyisoft.cloud.core.log.LogUtil;
@Configuration
public class UploadConfig {
private static Logger logger = Logger.getLogger(UploadConfig.class);
@Autowired
private MultipartConfigElement multipartCo