1 Reply Latest reply on Nov 2, 2016 2:23 PM by Max Barkley

    ERRAI-CDI LoadAsync with Instance<T>

    Alfredo Poblador Newbie

      Hello.

       

      I'm working with errai 3.1.2.FINAL i have activated te async ioc and when i compile the project i have problems injecting Instance<T> classes i got these error

       

      [ERROR] java.util.concurrent.ExecutionException: org.jboss.errai.ioc.rebind.ioc.exception.UnsatisfiedDependenciesException:  @> com.aktios.carritusTechnology.tol.client.local.tracking.impl.TrackingJSONGeneratorImpl

      [ERROR]  - field org.jboss.errai.codegen.meta.MetaField:TrackingJSONGeneratorImpl.@javax.inject.Inject() private  javax.enterprise.inject.Instance<com.google.gwt.json.client.JSONObject> jsonObjFactory could not be satisfied for type: javax.enterprise.inject.Instance

      [ERROR]   Message: can't resolve bean: javax.enterprise.inject.Instance<com.google.gwt.json.client.JSONObject> ( @Default )

       

      When i disable this option compilation goes ok.

       

      Thanks.

        • 1. Re: ERRAI-CDI LoadAsync with Instance<T>
          Max Barkley Expert

          Hi Alfredo,

           

          In Errai 3.x, it is not possible to inject an Instance<T> with async loading enabled. The issue is that Instance<T> is a synchronous API, whereas when you enable async loading of beans an async API is required.

           

          If you need to dynamically create bean instances and have async bean loading in Errai 3.x, then you will have to use the AsyncBeanManager for looking up beans.

           

          Cheers.