相关疑难解决方法(0)

如何在Spring中处理MultipartException

我的配置在这里

我根据帖子中的答案进行了一些修改。

filterMultipartResolver

@Bean
public StandardServletMultipartResolver filterMultipartResolver() {
    return new StandardServletMultipartResolver();
}
Run Code Online (Sandbox Code Playgroud)

AppInitializer

public class AppInitializer implements WebApplicationInitializer {

    @Override
    public void onStartup(final ServletContext servletContext) throws ServletException {
        // Create the 'root' Spring application context
        final WebApplicationContext context = getContext();
        // Manage the lifecycle of the root application context
        servletContext.addListener(new ContextLoaderListener(context));
        final Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context));
        dispatcher.setMultipartConfig(getMultipartConfigElement());
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");
    }

    private static AnnotationConfigWebApplicationContext getContext() {
        final AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.register(AppConfig.class);
        return context;
    }

    private …
Run Code Online (Sandbox Code Playgroud)

java tomcat spring-security spring-webflow-2

5
推荐指数
1
解决办法
2970
查看次数

标签 统计

java ×1

spring-security ×1

spring-webflow-2 ×1

tomcat ×1