Java 如何使用spring boot创建JSF应用程序

Java 如何使用spring boot创建JSF应用程序,java,spring,spring-boot,jsf,Java,Spring,Spring Boot,Jsf,我正在尝试创建一个JSF Spring引导应用程序。这是我的代码: My pom.xml: 4.0.0 org.springframework.boot spring启动程序父级 2.4.0 tn.esprit.tp tp.spring.mvc.rest 0.0.1 tp-spring-mvc-rest TP弹簧 1.8 org.springframework.boot spring引导启动器数据jpa org.springframework.boot SpringBootStarterWeb

我正在尝试创建一个JSF Spring引导应用程序。这是我的代码:

My pom.xml:


4.0.0
org.springframework.boot
spring启动程序父级
2.4.0
tn.esprit.tp
tp.spring.mvc.rest
0.0.1
tp-spring-mvc-rest
TP弹簧
1.8
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴开发工具
运行时
真的
mysql
mysql连接器java
运行时
org.springframework.boot
弹簧起动试验
测试
org.apache.myfaces.core
MyFacesImpl
2.2.12
org.apache.myfaces.core
MyFacesAPI
2.2.12
org.apache.tomcat.embed
汤姆卡特·贾斯珀
org.ocpsoft.rewrite
重写servlet
3.4.1.最终版本
org.ocpsoft.rewrite
重写集成面
3.4.1.最终版本
org.primefaces
素面
6.1
src/main/webapp/WEB-INF/classes
org.springframework.boot
springbootmaven插件
org.apache.maven.plugins
maven surefire插件
2.19.1
面配置:


org.springframework.web.jsf.el.SpringBeanFacesELResolver
web.xml:


Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.jsf
org.springframework.web.context.ContextLoaderListener
org.springframework.web.context.request.RequestContextListener
SpringBoot应用程序:

@springboot应用程序
@启用自动配置
@组件扫描({“tp.spring.mvc.rest”})
公共类TpSpringMvcRestApplication扩展了SpringBootServletializer实现CommandLineRunner{
私有静态记录器Logger=Logger.getLogger(TpSpringMvcRestApplication.class.getName());
@自动连线
私人用户服务;
公共静态void main(字符串[]args){
运行(TpSpringMvcRestApplication.class,args);
}
@豆子
公共ServletRegistrationBean ServletRegistrationBean(){
FacesServlet servlet=新的FacesServlet();
返回新的ServletRegistrationBean(servlet,*.jsf);
}
@豆子
公共过滤器注册bean重写过滤器(){
FilterRegistrationBean rwFilter=新的FilterRegistrationBean(new RewriteFilter());
rwFilter.setDispatcherTypes(
EnumSet.of(DispatcherType.FORWARD、DispatcherType.REQUEST、DispatcherType.ASYNC、DispatcherType.ERROR));
rwFilter.addUrlPatterns(“/*”);
回流过滤器;
}
控制员:

@Scope(value=“session”)
@组件(value=“userController”)//Spring IoC中bean的名称
@ELBeanName(value=“userController”)//JSF使用的bean的名称
@Join(path=“/”,to=“/login.jsf”)
公共类用户控制器{
public void doLogin(){
System.out.println(“你好”);
}
}
XHTML登录页面:


连接
问题是,当我单击connexion按钮时,控制器中的方法没有被调用,我收到一个白标签错误页面

我如何解决这个问题


提前谢谢你

你能试着改变一下吗:

return new ServletRegistrationBean(servlet, "*.xhtml");