Good day. Trying to build a Spring MVC + Spring boot + Security project, pops up at startup:
org.springframework.beans.factory.BeanCreationException: There has been an error in the definition of an error that has been defined in the classroom resource path: ua / kiev / izodrom / egorov / configuration / AppConfig.class]: nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.multipart.commons.CommonsMultiplusResolver]: Factory method 'multipartResolver' threw exception; nested exception is java.lang.NoClassDefFoundError: org / apache / commons / fileupload / FileItemFactory
@Bean public UrlBasedViewResolver setupViewResolver() { UrlBasedViewResolver resolver = new UrlBasedViewResolver(); resolver.setPrefix("/WEB-INF/"); resolver.setSuffix(".jsp"); resolver.setViewClass(JstlView.class); return resolver; } @Bean public CommonsMultipartResolver multipartResolver() { return new CommonsMultipartResolver();
WEB:
public class WebInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.register(SecurityConfig.class); servletContext.addListener(new ContextLoaderListener(ctx)); ctx.setServletContext(servletContext); ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); } }