如何使用JSF 2.3和TomEE注入FacesContext? [英] How to inject FacesContext with JSF 2.3 and TomEE?
本文介绍了如何使用JSF 2.3和TomEE注入FacesContext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试将JSF 2.3与TomEE服务器一起使用,并且在将@Inject
注释与FacesContext
对象一起使用时遇到问题.
I've been trying to use JSF 2.3 with TomEE server and I'm having problems using the @Inject
annotation with the FacesContext
object.
使用它时,在启动TomEE服务器时出现以下异常:
When I use it, i get the following exception while starting my TomEE server:
SEVERE: CDI Beans module deployment failed
org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [javax.faces.context.FacesContext] is not found with the qualifiers
Qualifiers: [@javax.enterprise.inject.Default()]
我错过了什么吗? 谢谢.
Am I missing something? Thanks.
推荐答案
似乎某些JSF2.3功能必须通过设置使用的JSF版本来激活.
Seems like some JSF2.3 features must be activated by setting the used JSF version.
尝试通过添加以下空类来设置JSF版本:
Try setting JSF version by adding this empty class:
import javax.faces.annotation.FacesConfig;
/**
* The presence of the @FacesConfig annotation on a managed bean deployed within an application enables version specific
* features. In this case, it enables JSF CDI injection and EL resolution using CDI.
*
*/
@FacesConfig(version = FacesConfig.Version.JSF_2_3)
public class ConfigurationBean {
}
来自https://github.com/javaee/glassfish/issues/22094
这篇关于如何使用JSF 2.3和TomEE注入FacesContext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文