Which should we choice between javax.faces.bean.XScoped and javax.enterprise.context.XScoped

来源:互联网 发布:身份证登记软件下载 编辑:程序博客网 时间:2024/05/18 17:54

JSF+CDI+…

Which should we choice between

javax.faces.bean.XScoped and

javax.enterprise.context.XScoped

“Should I use javax.faces.bean.Request/Session/ApplicationScoped or javax.enterprise.context.Request/Session/ApplicationScoped?
Since CDI 1.0

Both annotation groups originate from different APIs, and have been specified (more or less) independently. While the JSF scope annotations have a clear focus on the JSF view technology, CDI requires scope annotations that are present, no matter if JSF is deployed or not (CDI can be used without JSF). So CDI had no choice but defining it’s own scopes. Unfortunately, Java EE 6 did not align this very well.

You should always use scopes from javax.enterprise.context when using CDI

from:
http://www.cdi-spec.org/faq/#accordion0

阅读全文
1 0
原创粉丝点击