在前面的例子中,使用了 Spring 的@Component注解,但是您可以使用 Spring 支持的任何方法(例如 XML 配置或使用 Spring Boot 时使用 Java 配置类)来注册 bean...如果数组中的元素数量 或Collection非常大,则可能会导致性能损失。要将有效负载划分为更小、更易于管理的块,您可以设置batchSize属性,如function2前面所示的 中所示。...11.5.使用 PDX 执行函数 将 Spring Data for Apache Geode 的 Function annotation 支持与 Apache Geode 的PDX Serialization...因此,Apache Geode 的 Spring Data 包括增强的 Function 支持,以自动将 PDX 类型的方法参数转换为由 Function 方法的签名(参数类型)定义的所需应用程序域对象类型...最后,如果您将 Function 参数视为一般性或 Apache Geode 的 PDX 类型之一,则 Spring Data for Apache Geode 会注意不要转换您的 Function 参数
Spring Data for Apache Geode 负责代表您将其注册到 Apache Geode。...为了简化区域创建,Apache Geode 的 Spring Data 将 Spring Data Repositories 的使用与使用新@ EnableEntityDefinedRegions注解的基于注解的配置的表达能力相结合...大多数 Spring Data 应用程序开发人员应该已经熟悉 Spring Data Repository 抽象 和 Spring Data for Apache Geode 的implementation...现在,当您定义Book类时,您还Book通过@Region在实体类型上声明 Spring Data for Apache Geode 映射注释来指定映射(存储)实例的区域。...Spring Data for Apache Geode 使用映射上下文(其中包含应用程序中定义的所有实体的映射元数据)来确定运行时所需的所有区域。
配置PDX 要启用 Apache Geode PDX 序列化,请使用 注释您的 Spring、Apache Geode 客户端或服务器应用程序类@EnablePdx,如下所示: @SpringBootApplication...PDX 序列化是 Java 序列化的替代方案,具有许多附加优势。...基于 Spring Data 的映射基础架构。...@Configuration 注释类,用于在 [Spring Boot] 应用程序启动期间在运行时配置 GemFire/Geode 系统属性。...、Spring Data 的注释Repositories。
原标题:Spring认证中国教育管理中心-Apache Geode 的 Spring 数据教程二十二(Spring中国教育管理中心) 9.2.1.按区域类型的实体映射 除了@Region注释,为Apache...在功能上,这些注释的处理方式@Region与 SDG 映射基础设施中的通用注释完全相同。然而,这些额外的映射注解在 Spring Data for Apache Geode 的注解配置模型中很有用。...9.4.MappingPdxSerializer Spring Data for Apache Geode 提供了一个PdxSerializer 名为的自定义实现MappingPdxSerializer...,它使用 Spring Data 映射元数据来自定义实体序列化。...但是,MappingPdxSerializer这是通过使用 Spring Data 的映射元数据来实现的,特别是通过使用 Spring Data 的@Id注释查找指定为标识符的实体属性 。
所有依赖Cache于此命名约定的Apache Geode 组件的 Spring Data ,因此您无需显式声明Cache依赖项。...通常,只有在 Spring Data for Apache Geode 的 XML 命名空间用于配置和引导添加到集群的新的非应用程序 Apache Geode 服务器的情况下,才应启用“自动重新连接”。...换句话说,当 Spring Data for Apache Geode 用于开发和构建 Apache Geode 应用程序时,不应启用“自动重新连接”,该应用程序也恰好是CacheApache Geode...Spring Data for Apache Geode 的这个特性(将use-cluster-configuration属性设置为true)的工作方式与cache-xml-location属性相同,除了...的配置元数据的 Spring Data。
基于搜索的查询还包括翻阅查询结果的能力。 此外,Spring Data for Apache Geode 添加了对基于 Spring Data Commons 投影基础设施的查询投影的支持。...通过指定使用 Spring Data for Apache Geode XML 命名空间的元素,Cache在与应用程序相同的 JVM 进程中使用默认设置创建和初始化单个嵌入式 Apache...Apache Geode 不是使用 Spring Boot 的应用程序服务器或 Java 主类,而是进行引导并托管您的应用程序。 Apache Geode 不是应用程序服务器。...Spring配置元数据,包括所有的SDG XML命名空间的元素。...换言之,没有任何的元素属性(如cache-xml-location,properties-ref,critical-heap-percentage,pdx-serializer-ref
= (Region) region; localRegion.put("1", "one"); localRegion.put("3", "three");...与其他 Spring Data for Apache Geode 命名空间元素一样,如果未配置缓存 bean 名称,则将使用上述命名约定。...Geode 的 Spring Data 都能满足您的需求。...上面的 #1 独立于您的 Spring [Boot] 和/或 [Data for Apache Geode] 应用程序,并且必须成功完成。...3) 此时,您可以跳过Apache Geode文档中的步骤 6-8 ,让Spring Data Geode发挥其魔力。
Spring Data for Apache Geode 提供、 、和Region 子元素来指定超时值和到期操作...在前面的示例中,properties元素 ( expirationSettings) 使用 SpEL 将操作值建立在实际ExpirationAction枚举类型的基础上,如果枚举类型发生变化,则会迅速导致识别失败...要使用 Spring Data for Apache Geode 启用持久性,请将任何元素上的persistent属性设置为,如以下示例所示:true <gfe:partitioned-region...Geode 提供了local-region用于创建本地区域的专用元素。...所有常见的配置选项都可用于 REPLICATE 区域。Spring Data for Apache Geode 提供了一个replicated-region元素。
当 a ClientCache、一个 Pool 和一个基于代理的 Region 都被定义但没有明确标识时,Spring Data for Apache Geode 会自动解析引用,如以下示例所示: <gfe...Spring Data for Apache Geode 导致DEFAULT池从gemfirePool. 在定义多个池并且客户端区域使用单独的池或根本不声明池的情况下,这样做很有用。...,或者您可以选择cache.xml 使用以下命令导入其中定义的所有 Region : Spring Data for Apache Geode 自动为定义的所有...5.5.3.配置区域 Spring Data for Apache Geode 通过以下元素为配置任何类型的 Region 提供全面支持: 本地区域: 分区区域: <partitioned-region...这两个选项是互斥的,在同一元素中使用两者会导致异常。
Spring Data for Apache Geode 通过其客户端缓存元素为每个配置提供专门的支持: client-region和pool....String Spring Data for Apache Geode 提供了一个< gfe-data:json-region-autoproxy/>元素,使 AOP组件能够建议适当的代理区域操作,它有效地封装了...在 Spring Data for Apache Geode 中,索引是用index元素声明的,如以下示例所示: <gfe:index id="myIndex" expression="someField...这不是特定于 Apache <em>Geode</em> <em>的</em> <em>Spring</em> <em>Data</em>。它是 Apache <em>Geode</em> <em>的</em>一个特性。...请参阅 <em>Spring</em> <em>Data</em> for Apache <em>Geode</em> XML 模式以获取完整<em>的</em>选项集。
但是,如果您正在启动一个绿地项目,建议您直接在 Spring 中配置 Cache、Region 和其他可插入的 Apache Geode 组件。...7.9.支持 Spring Cache 抽象 Spring Data for Apache Geode 提供了 Spring Cache Abstraction的实现, 以将 Apache Geode...使用 Apache Geode 序列化 为了提高 Apache Geode In-memory Data Grid 的整体性能,Apache Geode 支持一种称为 PDX 的专用序列化协议,除了在各种语言平台...本章讨论 Spring Data for Apache Geode 简化和改进 Apache Geode 在 Java 中的自定义序列化的各种方式。...对于这种情况,用于 Apache Geode 的 Spring Data 提供了一种特殊的方法Instantiator ,可以在反序列化期间为 Apache Geode 创建的每个新实例执行连接。
5.5.7.区域模板 Spring Data for Apache Geode 也支持 Region 模板。...Spring Data for Apache Geode 在其命名空间中包含五个 Region 模板标签: 除了标签之外,具体元素(连同抽象<gfe:*-region-template...模板的工作原理 Spring Data for Apache Geode 在ApplicationContext解析Spring配置元数据时会应用 Region 模板,因此必须按照继承的顺序声明 Region...但是,与CREATE TABLE IF NOT EXISTS …DDL 语法非常相似 ,Apache Geode XML 命名空间元素的 Spring Data现在包含一个ignore-if-exists...Spring Data for Apache Geode 通过使用嵌套eviction元素支持分区区域、复制区域和客户端、本地区域的所有驱逐策略(条目计数、内存和堆使用)。
借助 Spring Data for Apache Geode 的强大功能,您的 Spring Boot 应用程序已经包含为您创建区域和索引所需的所有配置元数据。...当您使用 Spring Data Repository 抽象时,我们知道您的应用程序将需要的所有区域(例如由带@Region 注释的实体类定义的区域)和索引(例如由带注释的@Indexed实体字段和属性定义的区域...Spring Boot 应用程序、Spring Data Repositories、以 Apache Geode 作为缓存提供程序的 Spring 缓存抽象(其中区域和索引不仅在客户端上创建,而且还推送到集群中的服务器...仅使用 Apache Shiro,使用 Spring Data for Apache Geode 的新@EnableSecurity注解来注解您的 Spring Boot 应用程序类, 并将一个或多个...application.properties具有所需安全凭证的Spring Boot文件 spring.data.gemfire.security.username=jackBlack spring.data.gemfire.security.password
这些选项分别对应于 Spring Data for Apache Geode 的 XML 命名空间中元素上的ignore-if-exists和override属性。...这些选项仅在 Spring Data for Apache Geode 中可用,并且存在以解决 Apache Geode 的已知限制。Apache Geode 没有等效的选项或功能。...5.7.配置磁盘存储 Spring Data for Apache Geode 支持DiskStore通过disk-store元素进行配置和创建,如下例所示: 元素<gfe-data...Spring Data for Apache Geodesuppress-import-on-init在元素上包含一个属性,用于禁止配置的快照服务在初始化时尝试将数据导入缓存或区域
创建简单查询 Spring Data for Apache Geode 专注于使用 Spring 在 Apache Geode 中存储和访问数据。...它还继承了 Spring Data Commons 项目的强大功能,例如派生查询的能力。本质上,您不需要学习 Apache Geode (OQL) 的查询语言。...(另一个 bean 定义),它使用应用程序的 Spring Data 存储库在 Apache Geode 上执行数据访问操作。...打开日志记录后,您可以看到 Spring Data for Apache Geode 代表您编写的查询。.../mvnw spring-boot:run. 或者,您可以使用构建 JAR 文件,.
或者,您可以使用文件中的 spring.data.gemfire.cache.off-heap.memory-size 和spring.data.gemfire.cache.off-heap.region-names...此外,该isbn字段之前已使用 Spring Data 的@Id注释进行了注释,该注释标识包含Book实例唯一标识符的字段,并且在 Spring Data for Apache Geode 中,@Id...@Id带注释的字段或属性会导致创建 Apache GeodeKEY索引。 @Indexed带注释的字段或属性会导致创建 Apache Geode HASHIndex(默认值)。...6.14.配置 Spring 的缓存抽象 使用 Spring Data for Apache Geode,Apache Geode 可以用作 Spring缓存抽象中的缓存提供者 。...在 Spring Data for Apache Geode 中,SpringCache直接对应于 Apache Geode Region。在调用任何缓存注释的应用程序服务方法之前,该区域必须存在。
此注释对应 于 SDG 的 XML 命名空间中的元素。可以在此处找到更多详细信息。...该注解通过注册代理所有在 Spring 容器中声明为 bean 的 Region 的 AOP Aspect,拦截 Region 操作并记录事件来跟踪在 Region 上执行的所有数据访问操作。...6.19.结论 正如我们在前几节中了解到的,Spring Data for Apache Geode 的新的基于注解的配置模型提供了巨大的力量。...一旦您明确提供了一个 bean 定义,否则 Spring Data for Apache Geode 会使用其中一个注解提供,基于注解的配置就会退出。...您必须 org.apache.geode:geode-redis在 Spring [Boot] 应用程序类路径上显式声明该模块。 请参阅@EnableRedisServerJavadoc。
原标题:Spring认证中国教育管理中心-Apache Geode 的 Spring 数据教程八(Spring中国教育管理中心) 5.8.1.快照位置 对于基于缓存的快照服务(即 a CacheSnapshotService.../to/snapshots.zip"/> Spring Data for Apache Geode 方便地提取提供的 zip 文件并将其视为目录导入...为此,Apache Geode 的 Spring Data 定义了两个额外的 Spring 应用程序事件,分别扩展了 Spring 的 ApplicationEvent 导入和导出类: ImportSnapshotApplicationEvent...数组SnapshotMetadata覆盖了由 和子元素定义的快照元数据,在快照应用程序事件未明确提供的情况下使用...5.10.1.Apache Geode 7.0 中的 WAN 配置 在以下示例中,GatewaySenders被配置用于PARTITION通过将子元素(区域gateway-sender和gateway-sender-ref
原标题:Spring认证中国教育管理中心-Apache Geode 的 Spring 数据教程十七(Spring中国教育管理中心) 6.20.16。...配置集群配置 当使用 Apache Geode 作为 Apache GeodeClientCache应用程序开发 Spring Data 应用程序时,在开发期间配置服务器以匹配客户端/服务器拓扑中的客户端很有用...您可以使用Gfsh创建您的应用程序需要的每个区域和索引,或者,您可以在运行时简单地推送在使用 Apache Geode 开发 Spring Data 应用程序时已经表达的配置元数据。...[Boot] 中定义的 Apache Geode / Pivotal GemFire 模式对象定义、ClientCache使用 Spring 配置的Apache Geode / Pivotal GemFire...GatewaySender1将被配置为复制 Region1’s data and `GatewaySender2将被配置为复制`Region2 的数据。
POJO 映射描述了使用 Spring Data 存储在 Apache Geode 中的 POJO 的持久性映射。...Spring Data for Apache Geode Repositories描述了如何通过使用基本的 CRUD 和简单的查询操作来创建和使用 Spring Data Repositories 来访问存储在...有关如何为 Apache Geode Repositories 配置 Spring Data 的更多信息,请参阅Spring Data for Apache Geode Repositories。...它可以配置一个或多个嵌套locator 或server元素以连接到现有数据网格。此外,支持可用于配置池的所有属性。...此配置为连接到 Locator 的集群成员上定义的每个 Region 自动创建客户端 Region bean,因此它们可以被 Spring Data 映射注释 ( GemfireTemplate)无缝引用并自动装配到应用程序类中
领取专属 10元无门槛券
手把手带您无忧上云