Spring Download with JSF Bean

I am trying to create a project with Spring Boot and JSF. I add a servlet mapping as follows:

@ComponentScan() @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication app = new SpringApplication(Application.class); app.setShowBanner(false); app.run(args); } @Bean public ServletRegistrationBean servletRegistrationBean() { FacesServlet servlet = new javax.faces.webapp.FacesServlet(); return new ServletRegistrationBean(servlet, "/faces/*"); } } 

This is my index.xhtml:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head> </h:head> <h:body> <h1>Hello World</h1> <h:form> <p><h:outputText value="#{userView.value}"/></p> </h:form> </h:body> </html> 

My JSF bean:

 @ViewScoped @ManagedBean(name = "userView") public class UserView { private String value = "This editor is provided by PrimeFaces"; public UserView() { super(); System.out.println("userView"); } @PostConstruct public void init() { System.out.println("---------"); } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } 

I added faces-config.xml:

 <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd" version="2.2"> <application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> </application> </faces-config> 

But Spring doesn't control my JSF bean, can you help me?

thanks

+3
spring spring-boot jsf jsf-2
source share

No one has answered this question yet.

See similar questions:

7
Spring Download and JSF / Primary / Richfaces

or similar:

1873
What is the difference between @Component, @Repository and @Service annotations in Spring?
782
What is the difference between JSF, Servlet and JSP?
708
How to configure port for Spring Boot application
347
How to choose a bean area?
8
IntelliJ + Spring Web MVC
one
Error using faces-config.xml and primefaces-sentinel.taglib.xml when using premium premium themes
one
Component tree does not expand when using ui: debug facelet tag
0
RichFaces declaration errors faces-config.xml
0
Javascript function does not work inside JSF composite control
-one
JSF - managed component = null after redirect

All Articles