This idea just popped into my head and I'm interested in thoughts.

So I've been racking my brain all throughout the 3.x cycle on a possible good way to get an injection service of some kind into the mix. Something that would allow you to annotate a test case for example and say "inject me". Same would go for a standalone app client or any object really.

We could of course make a class for this say InjectionManager.class with a method "public void inject(Object o)" but who wants to bind themselves directly to org.apache.openejb.* classes -- I wouldn't. Then suddenly this came to me....

The javax.naming.Context.bind(*) methods are off limits anyway for EJB- land, they don't do anything... So... what if we started co-opting it for our own evil purposes :) We could start designating special names that if you "bind" to them will perform specific operations.

Say for example:

 context.bind("<some-standard-prefix>/inject", myObject);

We'd take the myObject, scrape the annotations and inject everything we could into the myObject instance.


Thoughts?

-David

Reply via email to