我们可以使用注释或 Java 反射转换字段 to/from GemFire PdxSerializer 吗?

Can we convert fields to/from GemFire PdxSerializer using annotations or Java Reflection?

目前我们正在使用 GemFire 进行缓存。我们正处于整合它的初始阶段。

虽然我们正在努力使用 Spring Data GemFire 库并使用 GemFire 的 PdxSerializer 来集成 GemFire,但我想知道是否有一种使用基本注释和 Java 反射 to/from PDXReader/PDXWriter 转换字段的方法。

我们正在使用 Sprint Boot 的 2.0.3.RELEASE JAR。

注意:我看过下面link:

https://gemfire.docs.pivotal.io/95/geode/developing/data_serialization/auto_serialization.html

我更好奇如何使用非XML方式来做到这一点。

看看下面的:

  1. SDG 的 o.s.d.g.mapping.MappingPdxSerializer as described in the documentation.

  2. 再读how to configure it.

  3. 如果您使用的是Spring Boot for Pivotal GemFire, then PDX is auto-configured automatically,默认情况下,您不需要显式声明SDG的@EnablePdx注释。

NOTE: SDG's MappingPdxSerializer, when configured and registered with Pivotal GemFire, automatically de/serializes your application domain object types without any special config, like you have to do when using GemFire's own ReflectionBasedAutoSerializer and clumsy REGEX to identify your types properly, blah! SDG's MappingPdxSerializer is much more robust, using first-class filters to express exclusions and even inclusions (which can override the default exclusions, that is any class types in java.*, com.gemstone.gemfire.*, org.apache.geode.* or org.springframework.*, by default).

总之...

吃 2 粒药,早上打电话给我 - "doc", ;-)