Hello,
I'm using <j2ee:jndi-lookup> to get my DataSource. I'd like the JNDI environment to be configurable, so I'm using a PlaceHolder and a properties file to set java.naming.factory.initial.
So I've set :
But I also want this property to be optional, so that I can get the default JNDI context.Code:<j2ee:jndi-lookup id="dataSource" jndi-name="jdbc/BGCAF"> <j2ee:environment> java.naming.factory.initial=${datasource.JndiFactory.className} </j2ee:environment> </j2ee:jndi-lookup>
If I don't set the property, the placeholder fails (Could not resolve placeholder...).
If I set the property to "" (empty), I get a NoInitialContextException as InitialContext tries to instantiate "" class.
Is there any way to make some part of the Spring context optional ?


Reply With Quote