I have a producer method that creates instances of—let's say—Person
.
The instance that this method creates is of type PersonBean
and quite obviously implements Person
.
This class has an initializer method in it:
@Inject
public void setSomething(final Something something) {
// whatever
}
There is also a Something
implementation on the classpath in a bean archive that should be a candidate for injecting here.
I've observed that this implementation is injected into an appropriately-annotated field of another non-producer-method-produced object, so I know Weld is finding it, it's valid, etc. etc.
The specification is not clear (to me) on whether or not my producer method's return value will then also have Weld/container-provided dependency injection applied to it.
I am certainly observing that this initializer method is not called automatically.
Boiled down, my question is: if I am producing an object, then does that mean my producer method must take care of all initialization of that object, or (what I'd expect instead) is my producer method only responsible for instantiation?