[jboss-user] [JBoss Microcontainer Users] - Re: Injecting bean instances in Servlets/EJBs
alesj
do-not-reply at jboss.com
Sun Sep 20 04:07:47 EDT 2009
"genman" wrote : Looked over the documentation but I didn't really see any explanation or recommendation for how deployed beans are supposed to be accessed through Servlet deployments. Is JNDI the suggested way? Is there support for @javax.annotation.Resource tags for accessing your own beans? (I wonder how JBoss AS implements @Resource...)
|
There is simple integration that I wrote for Servlet + MC usage:
- http://anonsvn.jboss.org/repos/jbossas/projects/mc-int/trunk/servlet/
- http://anonsvn.jboss.org/repos/jbossas/projects/mc-tools/grapher/trunk/src/main/java/org/jboss/mctools/grapher/GrapherServlet.java
"genman" wrote :
| JNDI might be okay. If so, how can I be sure the Servlet is initialized AFTER my bean is?
|
You can define explicit dependency.
Afaik WebModule - which is how we deploy servlets - has depends notion.
Although I would have to look where you define them.
You could also add it through jboss-dependency.xml:
- http://www.jboss.org/community/docs/DOC-13178
"genman" wrote :
| I guess I'm really after something like what Web Beans promises, which is integration of POJOs/dependency injection with JEE.
|
| As an aside, I don't really see any code sharing between Microcontainer, Seam/Web Beans, which is odd, considering the functionality is in many ways similar.
This is exactly what Kabir is working on now:
- http://anonsvn.jboss.org/repos/jbossas/projects/kernel/trunk/webbeans-int/
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256048#4256048
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256048
More information about the jboss-user
mailing list