Skip to content

Usage of 3rd party SPI ObjectFactory implementations (New in 0.21.0)

Holger Thurow edited this page Nov 25, 2019 · 4 revisions

Many ObjectFactory implementations out there are not fully SPI compatible in that they do not check the required type when called and always return an object no matter whether this object's type is appropriate. This problem was encountered and solved by Marcel Kalai (for background information see Add support for tomcat factory attribute). These implementations can not be registered via java.naming.factory.object in jndi.properties as described in Load self defined types as Beans or how to hook into the object creation process (New in 0.15.0). Instead these factories must be declared in the resource file with the new property javaxNamingSpiObjectFactory:

zzz/connection/type = a.b.c.Z // the type the ObjectFactory returns
zzz/connection/javaxNamingSpiObjectFactory = a.b.c.FactoryZ // the ObjectFactory's class name
zzz/connection/port = 9000
zzz/connection/property = something