[jboss-dev-forums] [Design of POJO Server] - Re: Generalizing dependency injection

scott.stark@jboss.org do-not-reply at jboss.com
Tue Mar 11 11:15:39 EDT 2008


"wolfc" wrote : Business interfaces can be implemented by multiple beans, so there must be a clarifier in between.
  | + "ejb/" + vfsPath + local-interface name  + "/" + ejbName should work.
  | 
  | If we then get a non-deterministic injection we can throw an exception.
  | Why not reverse it a bit:
  | + "ejb/" +  local-interface name  + vfsPath + "/" + ejbName
  | then traversal is a bit easier in case multiple jars within one ear contain the same interface.
Working through the resolution implementation more, we want a simple lookup to resolve a reference, so the ejbName of the providing cannot be part of at least one form of the key. That is an unknown element from the point of view of the referencer. We need multiple keys for each provider, some of which may be non-unique.


  | @EJB(beanInterface=X.class)
  | 
translates to a lookup of the provider "ejb/X". If we have multiple providers of the X interface, only the first to be processed would be the provider? If we want to fail an attempt at injection of a non-unique provider, we would have to track the duplicate providers to thrown an exception with the duplicates.


  | @EJB(beanInterface=X.class, name="XBean")
  | 
translates to a lookup of "ejb/X/XBean". The ejb-name is only unique within an ejb-jar, so here again we can have duplicates sources matching this key.


  | @EJB(beanInterface=X.class, name="XBean#some.jar")
  | 
translates to a lookup of "ejb/X/some.jar/XBean". This is the only guaranteed unique key within a deployment.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135656#4135656

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135656



More information about the jboss-dev-forums mailing list