File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Dependency injection and deployment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Dependency injection and deployment" Watch "Dependency injection and deployment" New topic

Dependency injection and deployment

Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
I am using dependency injection by the container and injecting SessionBean into my JSF backing beans. Will this work if I deploy web application (.war containing JSF stuff) on a separate web server and .ear containing session beans on a separate application server?

xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 137
Amit, as per my understanding it will not work. if DI releated code has been deployed as an EAR and you are trying to pull that value in web application ( assuming webapplication is not a part of EAR), it will not work. Instead you can try using JNDI lookup.
Marcelo Ortego

Joined: May 31, 2005
Posts: 9
I agree with Xsunil. This is my understanding also. If the .ear contains the .war, then DI will work. Otherwise you will need to perform context lookups.

If anyone can prove the contrary, please do.
Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
Thanks guys. Since I am using DI and injecting SessionBean into JSF backing bean, thus I will keep both .war in the same .ear.
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 489

Hi rancher
Reading this post I was thinking...I need to declare in my assignment How I'll be generated as the war + ejb jar's or ear?
The proposed solution is not a high level?


Fernando Franzini - Java Blog
I agree. Here's the link:
subject: Dependency injection and deployment
jQuery in Action, 3rd edition