PDA

View Full Version : creating a bean



adrianos
Sep 22nd, 2004, 12:39 PM
Say you want to instantiate some DAO using a JNDIBeanFactory. You want to pass the DataSource from a SessionBean to the constructor of the DAO. How can you do this - I can't see how you specify constructor arguments at all when creating a bean.

Please help

Thanks

rafeco
Sep 22nd, 2004, 01:34 PM
Using constructor-arg elements, as explained here:

http://www.springframework.org/docs/reference/beans.html#beans-factory-collaborators

robh
Sep 22nd, 2004, 02:40 PM
Why would you want to pass the DataSource from the SessionBean? If the DataSource is bound in JNDI then you can inject it straight into your DAO using JndiObjectFactoryBean.

Rob