I have a Java EE datasource which I just want to be invoked if a property is set. Can a system property or vm argument be set so as to just use this Java EE datasource if its true. Spring attempts to connect to this jndi datasource on server startup but I need to control when this connection is made. So in certain situations Spring should not attempt to make a connection to datasource "myDataSource" . Here is the config within my context file :
<jee:jndi-lookup id="myDataSource" jndi-name="jdbc/mydb"
resource-ref="true" expected-type="javax.sql.DataSource" />
Can I use spring expressions to control this :
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/expressions.html
Reading the accepted answer here :
Conditional statement inside Spring config I may be able to use a vm argument to indicate if the jndi datasource should be used ?