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

      Hi,

       

      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.

       

      @RunWith(JeeunitRunner.class)

      public class MyblogRepositoryTest {

       

                @Inject

                private MyblogRepository<Member, Long> repository;

       

       

      Error:

      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

       

      @Produces

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

                                    InjectionPoint injectionPoint) {

       

       

      Here is the maven pom dependence I had.

      <dependency>

                                    <groupId>org.jboss.weld.se</groupId>

                                    <artifactId>weld-se-core</artifactId>

                                    <version>1.1.11.Final</version>

                                    <scope>test</scope>

                          </dependency>

       

      Pls help me in resolving this. thanks