9 Replies Latest reply on Aug 8, 2012 12:06 AM by nishant_k123

    Solder: @Exact no @Qualifier

    Vivian Steller Newbie

      Can someone point out why the @Exact annotation provided by Seam Solder is not @Qualifier annotated?


      I'm trying to use @Exact(SomeType.class) together with an @Inject'ed Instance<SomeType> which doesn't seem to work. Also doing the same thing programmatically fails:



      final SomeType someTypeInstance = injectedInstance.select(SomeType.class, new ExactLiteral(SomeType.class)).get();
      



      The exception thrown is:



      org.jboss.weld.exceptions.IllegalArgumentException: WELD-000814 Annotation @org.jboss.seam.solder.core.Exact(value=SomeType.class) is not a qualifier
           at org.jboss.weld.util.Beans.mergeInQualifiers(Beans.java:926)
           at org.jboss.weld.bean.builtin.FacadeInjectionPoint.<init>(FacadeInjectionPoint.java:29)
           at org.jboss.weld.bean.builtin.InstanceImpl.selectInstance(InstanceImpl.java:181)
           at org.jboss.weld.bean.builtin.InstanceImpl.select(InstanceImpl.java:176)
           at ...
      



      In general, what I want to do is:
      I've a class SomeType and another one SubclassOfSomeType that extends SomeType. Now, if I'm trying to inject SomeType (I really want an instance of the exact class SomeType injected, not any subclass of it) I get an ambiguous resolution exception, since both SomeType and SubclassOfSomeType meet the requirements for the injection point. I think @Exact is exactly what I need here, right?


      Would be nice if someone could help out...


      Thanks!