Hi guys
I am trying to make a producer method that can produce references to our remote EJB's, basically a replacement for @EJB. The purpose is to be able to introduce proxies on the client side, caching, and dynamic remote host configuration.
I have got the plumbing in place, but I'm having problems welding it all together.. What I would like to do is this:
@Inject @Service
private StatusService statusService;
Where a producer method is able to find the right service. And my working producer method looks like this:
@Produces @Service
public StatusService getStatusService(InjectionPoint ip) throws NamingException {
return lookupRemoteEJB((Class)ip.getAnnotated().getBaseType());
}
But, if I change the return type of this method to BaseService (which StatusService inherits from), or just Object, I get this exception:
UnsatisfiedResolutionException: WELD-001308 Unable to resolve managed beans for Types: [interface no.evote.service.StatusService]; Bindings: [@no.evote.presentation.Service()]
Which is sort of..unsatisfying.
StatusService looks like this:
@Service
public interface StatusService extends BaseService {
...
}
And @Service is a qualifier:
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
@Inherited
public @interface Service {
}
Is there any way I can keep the producer method generic while still having the clean injection syntax?
Regards,
Anders