2 Replies Latest reply on Jul 31, 2013 2:55 PM by Dhana kumar

    weld se junit to inject generic repository having generic argument types

    Dhana kumar Newbie



      this is closely related to the thread, https://community.jboss.org/thread/212803


      I were not successful to have the following dependency injected in my junit test.



      public class MyblogRepositoryTest {



                private MyblogRepository<Member, Long> repository;




      org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [interface org.anem.myblog.data.MyblogRepository<class org.anem.myblog.domain.member.Member,class java.lang.Long>]; Bindings: [QualifierInstance{annotationClass=interface javax.enterprise.inject.Default, values={}, hashCode=1874660547}]


      (But this works if i have same generic type <Member, Long> as producer, Can't I define Producer by ignoring generic agruments type, also eclipse shows warning for the above injection, 'No bean eligible for injection to the injection point')


      I have producer for this in Resources.java



                public <E extends Persistable<ID>, ID extends Serializable> MyblogJpaRepository<E, ID> produceMyblogRepository(

                                    InjectionPoint injectionPoint) {



      Here is the maven pom dependence I had.








      Pls help me in resolving this. thanks