ejb 3.0 - circular ejb dependencies: what does the spec say? -
i know experience injection of circular dependencies in ejb work, @ least in application servers.
i've done multiple times self-injection (e.g. ejb proxy @transactionattribute, @rolesallowed, @asynchronous etc. work).
i've done more complex graphs (a->b->a etc.), work too.
i've done @ least in glassfish 3/4, weblogic, , jboss 7.3. maybe weblogic, not sure.
now, i've been trying find precise guarantee specification, without success. there provisions in cdi, couldn't find explanation on why works ejbs. there indirect one, maybe?
i'm looking references ejb specifications regarding this.
i don't believe ejb specification explicitly disallows self-injection, means implicitly allows since there no reason bean's own interface different interface of other ejb. in practice, self-injection can work stateless (and singleton in ejb 3.1) , not stateful since each lookup/injection of stateful bean creates new instance, result in infinite recusion. stateful, can inject sessioncontext , use getter methods return "self-proxy" rather using injection. technique works stateless/singleton, , might marginally faster using injection (particularly if cache result in instance field same injection) since ejb container can return self-proxy more directly going through injection/jndi.
the additional authority can give answer 1 of primary developers/maintainers of ejb container in websphere application server 5 years. add list of products, know self-injection works in practice on websphere application server.
Comments
Post a Comment