Is there any way to inject a concrete implementation of @Produces returned interface?
SomeClassImpl implements SomeClass {
public Integer iField;
}
Producer class:
@Produces
public SomeClass produceChild(){
SomeClassImpl impl = new SomeClassImpl();
impl.iField = 17;
return impl;
}
Consumer class:
@Inject SomeClassImpl classImpl;
EDIT
The attempt to @Inject SomeClassImpl doesn't force container to use the @Produces method that returns super-type SomeClass.
Why it is possible to inject child-type via @Inject parent-type (without Producer), but no variants inject child-type via @Produces parent-type ?