This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Would you ever use injection for referencing an EJB in a JSF managed bean?

 
emanuel petre
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some people here said that the ServiceLocator is not anymore needed in EJB 3 because of the new way of injecting dependencies trough annotations.
This can be true in case of EJB -> EJB dependency. But, in case you want to call an EJB from the web tier, you still need to use a Service Locator. First,
you have the possibiltiy to inject an EJB by using annotations in the web components managed by server (like ServletListener or a JSF managed bean).
But, this way you expose the business tier directly to the presentation and you strongly couple the two. The only solution, I think, is to use a Business Delegate for abstractizing the business to the presentation. The Business Delegate will not be a component managed by the container. As a consequence, you cannot use injection in this case and you need a Service Locator.

That's why I think, the EJB injection shouldn't be used in a JSF managed bean.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic