I\'m running my JSF project launching it with Spring Boot and taking advantage of the whole Spring environment. The configuration is: Mojarra 2.2.8 + Primefaces 5.1 + Spring
Finally, I got it working using the Apache Commons library. Similarly that what we might do in a standard web.xml file, that's my context initializer:
@Bean
public ServletContextInitializer initializer() {
return new ServletContextInitializer() {
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
servletContext.setInitParameter("primefaces.THEME", "bluesky");
servletContext.setInitParameter(
"javax.faces.FACELETS_SKIP_COMMENTS", "true");
servletContext.setInitParameter(
"com.sun.faces.expressionFactory",
"com.sun.el.ExpressionFactoryImpl");
servletContext.setInitParameter("primefaces.UPLOADER",
"commons");
}
};
}
I explicitly tell Primefaces to use the commons uploader, like said in docs (the other choice is to use native, which is not working).
Then, just adding this two dependencies to the project, we're ready to go:
commons-fileupload
commons-fileupload
1.3
commons-io
commons-io
2.2
I keep the thread opened for some response based in the native mode.
See also: