Updated Description
Enhance the PojoCodeProvider such that multiple instance can be added to the same registry and POJO codecs can be looked up between the providers.
Original Description
Using multiple codec providers sometimes causes a problem with a failure to find the 'log_entry' discriminator.
It appears that loading the same set of providers does not cause a failure if loaded in a different order.
e.g the following code causes a failure
{ CodecRegistry pojoCodecRegistry = CodecRegistries.fromRegistries( CodecRegistries.fromCodecs(new UuidCodec(UuidRepresentation.STANDARD)), CodecRegistries.fromProviders(_getCodecProvider1(), _getCodecProvider2()), // CodecRegistries.fromProviders(_getCodecProvider()), MongoClientSettings.getDefaultCodecRegistry()); }
However replacing the line to load the codeC provider with :
{ CodecRegistries.fromProviders(_getCodecProvider(),_getCodecProvider1(),_getCodecProvider2()), }
or this
{ CodecRegistries.fromProviders(_getCodecProvider()), MongoClientSettings.getDefaultCodecRegistry()); }
does not cause a failure.
So it appears that the issue is related to :
1. Allowing more than 1 provider.
2. The order in which the providers are loaded.
Please advise.
Best regards,
Sheila