Is there any way to pass parameters to an object factory? What I'm
looking to do is have the object factory bound at "bean/mybean" and
expose "foo=?,bar=?" to the getObjectInstance() method of
test.MyBeanFactory to be used as initialization parameters.
The following doesn't work in tomcat, but it's more or less what I'd
like to do:
<Resource
name="bean/mybean"
factory="test.MyBeanFactory"
type="test.MyBean"
auth="Container"/>
Context initCtx = new InitialContext();
Context ctx = (Context) initCtx.lookup("java:comp/env");
MyBean mybean1 = (MyBean) ctx.lookup("bean/mybean/foo=1,bar=xyz");
MyBean mybean2 = (MyBean) ctx.lookup("bean/mybean/foo=2,bar=abc");