2 Replies Latest reply on May 22, 2012 10:43 AM by Mike Brock

    Is @Any supported?

    Jervis Liu Apprentice

      Hi, I have following code using @Any:

       

      Map<String, Activity> activites = new HashMap<String, Activity>()

       

      @Inject

      void initServices(@Any Instance<Activity> activities) {

          for (Activity activity: activities) {

              activites.put(activity.getNameToken(), activity);

          }

      }

       

      Then I have all Activity classes marked as @ApplicationScoped for example:

       

      @ApplicationScoped

      public class MyAdminAreaActivity extends Activity {

       

      }

       

      I would like to use this code to have all Activity classes instantiated then get them injected into activities. However during the debug I found activities is empty. I wonder if @Any is already supported in Errai or did I do any wrong? Thanks.

       

      Cheers,

      Jervis