【问题标题】:WELD-001410: The injection point has non-proxyable dependenciesWELD-001410:注入点具有不可代理的依赖关系
【发布时间】:2012-09-06 01:50:52
【问题描述】:

我有两个托管 Bean:

会话Bean:

@Named(value = "sessionBean")
@SessionScoped
public class SessionBean implements Serializable {

  private final Param param

  SessionBean(Param param) {
      this.param = param;
  }

}

和 TypesBean:

@Named(value = "typesBean")
@RequestScoped
public class TypesBean {

  @Inject
  private SessionBean session;

}

项目构建,但不部署:

部署期间发生错误:加载应用程序时出现异常:WELD-001410 注入点 [field] @Inject private com.example.TypesBean.session 具有不可代理的依赖项。有关详细信息,请参阅 server.log。

有什么问题?

【问题讨论】:

    标签: jsf proxy cdi


    【解决方案1】:

    问题在于 SessionBean 类上缺少可访问的无参数构造函数。

    OP 指出的一个解决方案是:

    “问题出在 SessionBean 的 final 方法中。删除 final 并将方法公开 - 解决问题。抱歉浪费了 您的时间。 "

    或者……

    @Named(value = "sessionBean")
    @SessionScoped
    public class SessionBean implements Serializable {
    
      . . . //variables, setters, getters and other methods
      private final Param param
    
      public SessionBean(Param param) {
          this.param = param;
      }
      // no-args constructor used by CDI for proxying only 
      // but is subsequently replaced with an instance 
      // created using the above constructor. 
      protected SessionBean() {
         this(null);
      }
    

    【讨论】:

    猜你喜欢
    • 2018-06-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 2011-12-31
    • 1970-01-01
    • 2012-02-20
    相关资源
    最近更新 更多