Spring Boot with JSF; Could not find backup for factory javax.faces.context.FacesContextFactory

后端 未结 2 1720
攒了一身酷
攒了一身酷 2020-12-05 12:23

I\'m having some problems with Spring Boot and JSF. The servlet appears to start up correctly, but when I attempt to access a resource I get the following exception

2条回答
  •  天涯浪人
    2020-12-05 12:52

    probably you forget add listener com.sun.faces.config.ConfigureListener.class :

      @Bean
        public ServletContextInitializer servletContextInitializer() {
    
            return sc -> {
                ***sc.addListener(com.sun.faces.config.ConfigureListener.class);***
                sc.setInitParameter("com.sun.faces.expressionFactory", "com.sun.el.ExpressionFactoryImpl");
                sc.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());
                sc.setInitParameter("facelets.DEVELOPMENT", Boolean.TRUE.toString());
                sc.setInitParameter("javax.faces.DEFAULT_SUFFIX", ".xhtml");
                sc.setInitParameter("javax.faces.FACELETS_LIBRARIES", "springsecurity.taglib.xml");
                sc.setInitParameter("javax.faces.FACELETS_REFRESH_PERIOD", "1");
                sc.setInitParameter("javax.faces.FACELETS_SKIP_COMMENTS", Boolean.TRUE.toString());
                sc.setInitParameter("javax.faces.PARTIAL_STATE_SAVING_METHOD", Boolean.TRUE.toString());
                sc.setInitParameter("javax.faces.PROJECT_STAGE", "Development");
                sc.setInitParameter("javax.faces.STATE_SAVING_METHOD", "server");
                sc.setInitParameter("primefaces.CLIENT_SIDE_VALIDATION", Boolean.TRUE.toString());
                sc.setInitParameter("primefaces.FONT_AWESOME", Boolean.TRUE.toString());
                sc.setInitParameter("primefaces.THEME", "Omega");
            };
        }
    

提交回复
热议问题