I have a Wildfly application with an Infinispan cache containing objects that require custom serialization.
The Infinispan documentation for Marshalling and Encoding Data recommends to use the protobuf-based Protostream marshaller.
I have generated the Protostream marshaller and serialization context initializer for the custom objects as described in the corresponding documentation section.
I have also configured the cache container to use "PROTOSTREAM" marshaller via the Wildfly Infinispan subsystem configuration attribute:
<cache-container marshaller="PROTOSTREAM" ... ><!-- ... --></cache-container>
How can I configure the Wildfly Infinispan subsystem to use my custom serialization context initializer?
According to the Infispan documentation section on Registering serialization context initializers, there are two mechanisms:
- Automatic detection via
java.util.ServiceLoader - Manual registration via
serialization/context-initializer
The documentation warns that
If you manually register one
SerializationContextInitializerimplementation, it disables automatic registration. You must then manually register all other implementations.
Now, Wildfly itself already registers various serialization context initializers of its own. Consequently, automatic detection is disabled.
Is there a way to declaratively configure custom serialization context initializers via Wildfly Infinispan subsystem configuration?
(Note that the custom serialization context initializer implementation is generated by the annotation processor into the "target/" folder. Thus, I want to avoid programmatic registration because that would involve either loading that class by name or creating a separate project in order to reference that implementation class.)