1 Reply Latest reply on Mar 26, 2013 11:26 AM by cbrock

    MVP multiples regions with CDI and Errai UI

    crinaldi

      I'm implementing MVP (Activities and Places) with Errai-ui. And I have two regions

      Center and Popup.

       

      Are created as follows:

       

      @Produces

      @Singleton

      @Named("center")

      public ActivityManager getCenterActivityManager() {

          GWT.log("getCenterActivityManager()");

          return new ActivityManager(centerMapper, bus);

      }

         

      @Produces

      @Singleton

      @Named("popup")

      public ActivityManager getPopupActivityManager() {

          GWT.log("getPopupActivityManager()");

          return new ActivityManager(popupMapper, bus);

      }

       

       

      And injected as follows:

       

      @Inject

      @Named("center")

      private ActivityManager centerActivityManager;

         

      @Inject

      @Named("popup")

      private ActivityManager popupActivityManager;

       

       

      And then setting display for each of the Managers:

       

      centerActivityManager.setDisplay(layout.getCenterReqion());

      popupActivityManager.setDisplay(layout.getPopupRegion());

       

       

      But only one is injected, in this case: CenterActivityManager, the first in the orden of injection. I also tested with Binding Annotations instead of @Named, but the result is the same.

      I think it calls the same produces...

       

      Thanks