danizmax
danizmax

Reputation: 2456

DeploymentException: WELD-001408 on injection when using extended classes

I have the following DBOs:

public abstract class DetailDbo{
    ....
}

public abstract class MasterDbo<T>{
    ....
}

public class B extends DetailDbo{
    ....
}

public class A extends MasterDbo<B>{
    ....
}

My service:

@Stateless
@LocalBean
public class MyService<T extends MasterDbo<D>, D extends DetailDbo>{
    //implemetation
}

My bean:

public class MyBean<T extends MasterDbo<D>, D extends DetailDbo>{

    @Inject
    protected MyService<T, D>   ws;

    ...
}

Extended bean:

SpecialBean extends MyBean<A, B>{
    //implemetation
}

At the injection point I'm getting the following exception:

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [MyService<A, B>] with qualifiers [@Default] at injection point [[field] @Inject protected com.xxx.xx.MyBean.ws]

Why am I getting this error?

Thanks for help!

Upvotes: 1

Views: 443

Answers (1)

Antoine Sabot-Durand
Antoine Sabot-Durand

Reputation: 4980

Congratulation ! You've just discovered a bug in Weld : https://issues.jboss.org/browse/WELD-1855

While waiting for the fix, you can use this workaround. Change your EJB to :

@Stateless
@LocalBean
public class MyService<T extends MasterDbo<? extends DetailDbo>, D extends DetailDbo>{
    //implemetation
}

It should work.

Upvotes: 1

Related Questions