3.4. 使用自定义 marshallers
Data Grid 提供了一个 Marshaller 接口,您可以为自定义 marshallers 实施。
提示
自定义 marshaller 实现可以通过 initialize () 方法访问配置的访问列表,该方法在启动时调用。
流程
-
实施
Marshaller接口。 - 将 Data Grid 配置为使用您的 marshaller。
- 将您的 Java 类添加到反序列化允许列表中。
声明
programmatic
GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
builder.serialization()
.marshaller(new org.infinispan.example.marshall.CustomMarshaller())
.allowList().addRegexp("org.infinispan.example.*");
GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
builder.serialization()
.marshaller(new org.infinispan.example.marshall.CustomMarshaller())
.allowList().addRegexp("org.infinispan.example.*");