Yes. What you want to accomplish is called "injecting into a non-contextual
instance", or in other words "injecting into a non-bean instance". The
object is an injection target.
Here's the basic idea.
1. Obtain the BeanManager
2. Create a CreationalContext, a context that supports the injection process
3. Create an AnnotatedType for the class of the object receiving the
4. Create an InjectionTarget from that AnnotatedType
5. Use InjectionTarget.inject(Object, BeanManager) to satisfy the injection
points on the non-managed object
This operation is performed, amongst other places, in Arquillian's CDI test
enricher. It's how Arquillian takes the test case instance and satisfies
On Wed, Mar 9, 2011 at 15:02, aalmiray <aalmiray(a)yahoo.com> wrote:
I wonder if it's possible to offer a set of bean instances (not-managed by
the container) so that their dependencies are satisfied by the container.
an example, you can grab a Spring BeanFactory and call autowire on it, like
Is there a similar API in Weld/CDI?
View this message in context:
Sent from the Weld development discussions mailing list archive at
weld-dev mailing list
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597