mpetrashev: your lazy-init suggestion gave me the information I needed to get the solution myself. lazy-init is not available on jee:jndi-lookup tags....but.....
the datasource should specify the 'lookup-on-startup' attribute with value false.
Like this:
Code:
<!-- Data source for Adam -->
<jee:jndi-lookup id="adamDataSource" jndi-name="jdbc/adam" resource-ref="true" proxy-interface="javax.sql.DataSource" lookup-on-startup="false"/>
NB jee:jndi-lookup tag is available from Spring 2.0. Don't forget to add the following bold text on top of your bean XML:
Code:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
NB proxy-interface="javax.sql.DataSource" is required when setting the cache or lookup-on-startup attribute! This is mentioned when starting up without the proxy-interface attribute added.... ;-)