The JavaDoc of ObjectFactory.getObjectInstance(Object, Name, Context, Hashtable<?,?>) : Object specifies this behaviour:
"An object factory should only throw an exception if it is sure that it is the only intended factory and that no other object factories should be tried. If this factory cannot create an object using the arguments supplied, it should return null."
So if one configured multiple ObjectFactories to be asked if they can create a specific type by setting java.naming.factory.object to a list of object factories HikariJNDIFactory will prevent other factories from being consulted.
org.apache.commons.dbcp2.BasicDataSourceFactory does it this way:
if (!"javax.sql.DataSource".equals(ref.getClassName())) {
return null;
}
The JavaDoc of ObjectFactory.getObjectInstance(Object, Name, Context, Hashtable<?,?>) : Object specifies this behaviour:
"An object factory should only throw an exception if it is sure that it is the only intended factory and that no other object factories should be tried. If this factory cannot create an object using the arguments supplied, it should return null."
So if one configured multiple ObjectFactories to be asked if they can create a specific type by setting java.naming.factory.object to a list of object factories HikariJNDIFactory will prevent other factories from being consulted.
org.apache.commons.dbcp2.BasicDataSourceFactory does it this way: