Back Forum Reply New

JDBC/JNDI choice

I have an application where I need to choose between JNDI lookup for DataSource (Tomcat deployment) and JDBC DataSource (Tests and batch).

I found a solution :Code:
lt;bean id=quot;dataSourcequot; class=quot;JndiObjectFactoryBeanquot;gt;  ... lt;property name=quot;defaultObjectquot; ref=quot;jdbcDataSourcequot; /gt;
lt;/beangt;

lt;bean id=quot;jdbcDataSourcequot; class=quot;DriverManagerDataSourcequot;gt; ...
lt;/beangt;
However, in this case how could I be sure that jdbcDataSource is never instanciated if JNDI lookup is a success ?
Is there any 'lazy-init' param that I should use to ensure this scenario ?

Thanks for your help
¥
Back Forum Reply New