避免使用 javax.faces.bean 包中不推荐的注释和接口

此规则会标记是否使用了 javax.faces.bean 包中不推荐的接口和注释。 以下接口和注释替换为其他包中的接口和注释:

不推荐类

JavaEE8 类

javax.faces.bean.ApplicationScoped

javax.enterprise.context.ApplicationScoped

javax.faces.bean.CustomScoped

javax.enterprise.context.spi.Context

javax.faces.bean.ManagedProperty

javax.faces.annotation.ManagedProperty

javax.faces.bean.NoneScoped

javax.enterprise.context.Dependent

javax.faces.bean.RequestScoped

javax.enterprise.context.RequestScoped

javax.faces.bean.SessionScoped

javax.enterprise.context.SessionScoped

javax.faces.bean.ViewScoped

javax.faces.view.ViewScoped

通常,javax.faces.bean.ManagedBean 已替换为受管 Bean 规范,尤其是 CDI 规范中的依赖性注入、作用域和命名。 请注意,通过观察 javax.enterprise.context.ApplicationScopedjavax.enterprise.context.Initialized 事件,专门替换了应用程序作用域 Bean 的 eager 属性。

除了使用 faces-config.xml 中的 XML 变体外,javax.faces.bean.ReferencedBean 未进行任何直接替换