Yes. What you want to accomplish is called &quot;injecting into a non-contextual instance&quot;, or in other words &quot;injecting into a non-bean instance&quot;. The object is an injection target.<div><br></div><div><br></div>

<div>Here&#39;s the basic idea.</div><div><br></div><div>1. Obtain the BeanManager</div><div>2. Create a CreationalContext, a context that supports the injection process</div><div>3. Create an AnnotatedType for the class of the object receiving the injections</div>

<div>4. Create an InjectionTarget from that AnnotatedType</div><div>5. Use InjectionTarget.inject(Object, BeanManager) to satisfy the injection points on the non-managed object</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>

This operation is performed, amongst other places, in Arquillian&#39;s CDI test enricher. It&#39;s how Arquillian takes the test case instance and satisfies injection points.</div><div><a href="https://github.com/arquillian/arquillian/blob/master/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java">https://github.com/arquillian/arquillian/blob/master/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java</a></div>

<div><br></div><div>-Dan</div><br><div class="gmail_quote">On Wed, Mar 9, 2011 at 15:02, aalmiray <span dir="ltr">&lt;<a href="mailto:aalmiray@yahoo.com">aalmiray@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi guys,<br>
<br>
I wonder if it&#39;s possible to offer a set of bean instances (not-managed by<br>
the container) so that their dependencies are satisfied by the container. As<br>
an example, you can grab a Spring BeanFactory and call autowire on it, like<br>
this<br>
<br>
   app.applicationContext.getAutowireCapableBeanFactory()<br>
         .autowireBeanProperties(instance,<br>
AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false)<br>
<br>
Is there a similar API in Weld/CDI?<br>
<br>
TIA<br>
Andres<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://weld-development-discussions.46994.n3.nabble.com/Offering-beans-post-container-initialization-tp2656992p2656992.html" target="_blank">http://weld-development-discussions.46994.n3.nabble.com/Offering-beans-post-container-initialization-tp2656992p2656992.html</a><br>


Sent from the Weld development discussions mailing list archive at Nabble.com.<br>
_______________________________________________<br>
weld-dev mailing list<br>
<a href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><div>Dan Allen</div>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><div><a href="http://www.google.com/profiles/dan.j.allen#about" target="_blank">http://www.google.com/profiles/dan.j.allen#about</a><br>

<a href="http://mojavelinux.com" target="_blank">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br></div><br>
</div>