首页 > 其他分享 >Apache Geode 的 Spring Data(数据)(三)

Apache Geode 的 Spring Data(数据)(三)

时间:2022-11-22 18:01:59浏览次数:71  
标签:配置 Spring Geode 应用程序 注释 Apache

Apache Geode 的 Spring Data(数据)(三)_apache

6.12.4. 配置过期

与逐出一起,过期还可用于管理内存 允许存储在区域中的条目过期。Apache Geode同时支持生存时间(TTL) 和空闲超时 (TTI) 条目过期策略。

Spring Data for Apache Geode 基于注释的过期配置基于在 Spring Data for Apache Geode 版本 1.5 中添加的早期和现有的条目过期注释支持。

从本质上讲,Spring Data for Apache Geode的过期注释支持基于Apache Geode的org.apache.geode.cache.CustomExpiry接口的自定义实现。 此实现检查存储在区域中的用户应用程序域对象 用于存在类型级过期批注。​​o.a.g.cache.CustomExpiry​

Spring Data for Apache Geode 提供了以下过期注释:

  • ​Expiration​
  • ​IdleTimeoutExpiration​
  • ​TimeToLiveExpiration​

可以使用一个或多个过期批注对应用程序域对象类型进行批注,如下所示:

应用程序域对象特定的过期策略

@Region("Books")
@TimeToLiveExpiration(timeout = 30000, action = "INVALIDATE")
class Book { .. }

若要启用过期,请使用以下内容对应用程序类进行批注:​​@EnableExpiration​

启用了过期的 Spring 应用程序

@SpringBootApplication
@PeerCacheApplication
@EnableExpiration
class ServerApplication { .. }

除了应用程序域对象类型级过期策略之外,您还可以直接单独配置 使用注释按区域逐个区域的过期策略,如下所示:​​@EnableExpiration​

具有特定于区域的过期策略的 Spring 应用程序

@SpringBootApplication
@PeerCacheApplication
@EnableExpiration(policies = {
@ExpirationPolicy(regionNames = "Books", types = ExpirationType.TIME_TO_LIVE),
@ExpirationPolicy(regionNames = { "Customers", "Orders" }, timeout = 30000,
action = ExpirationActionType.LOCAL_DESTROY)
})
class ServerApplication { .. }

前面的示例为 、 和 区域设置过期策略。​​Books​​​​Customers​​​​Orders​

过期策略通常在服务器中的区域上设置。

有关过期配置选项的完整列表,请参阅@EnableExpiration注释 Javadoc。

有关Apache Geode过期的更多详细信息,请参见此处。

6.12.5. 配置压缩

除了逐出和过期之外,您还可以配置数据区域 具有压缩功能以减少内存消耗。

Apache Geode 允许您使用可插拔压缩器或不同的压缩编解码器压缩内存中的区域值。 Apache Geode默认使用Google的Snappy压缩库。

若要启用压缩,请使用以下命令批注应用程序类:​​@EnableCompression​

启用了区域压缩的春季应用程序

@SpringBootApplication
@ClientCacheApplication
@EnableCompression(compressorBeanName = "MyCompressor", regionNames = { "Customers", "Orders" })
class ClientApplication { .. }

这两个属性都不是必需的。​​compressorBeanName​​​​regionNames​

默认为,启用Apache Geode的SnappyCompressor。​​compressorBeanName​​​​SnappyCompressor​

该属性是一个区域名称数组,用于指定已启用压缩的区域。 默认情况下,如果未显式设置属性,则所有区域都会压缩值。​​regionNames​​​​regionNames​

或者,您可以在文件中使用和属性 以设置和配置这些注释属性的值。​​spring.data.gemfire.cache.compression.compressor-bean-name​​​​spring.data.gemfire.cache.compression.region-names​​​​application.properties​​​​@EnableCompression​

要使用Apache Geode的区域压缩功能,您必须包含依赖项 在应用程序的文件(对于 Maven)或文件(对于 Gradle)中。仅当您使用 Apache Geode对区域压缩的默认支持,默认情况下使用SnappyCompressor​。 当然,如果使用其他压缩库,则需要包含该压缩库的依赖项 在应用程序的类路径上。此外,您需要实现Apache Geode的Compressor​接口来适应您的压缩。 选择的库,在 Spring 压缩器中将其定义为 bean,并将 bean 定义设置为此自定义 Bean 定义。​​org.iq80.snappy:snappy​​​​pom.xml​​​​build.gradle​​​​compressorBeanName​

有关更多详细信息,请参阅@EnableCompression注释 Javadoc。

有关Apache Geode压缩的更多详细信息可以在这里找到。

6.12.6. 配置堆外内存

减少 JVM 堆内存压力和最小化 GC 活动的另一种有效方法是使用 Apache Geode的堆外内存支持。

条目不是存储在 JVM 堆上,而是存储在系统的主内存中。堆外内存 通常,当存储的对象大小均匀,大多小于 128K 且不需要时,效果最佳 经常反序列化,如 Apache Geode用户指南中所述。

若要启用堆外,请使用以下内容批注应用程序类:​​@EnableOffHeap​

启用了堆外的 Spring 应用程序

@SpringBootApplication
@PeerCacheApplication
@EnableOffHeap(memorySize = 8192m regionNames = { "Customers", "Orders" })
class ServerApplication { .. }

属性是必需的。属性的值指定主内存量 区域可以使用兆字节 () 或千兆字节 ()。​​memorySize​​​​memorySize​​​​m​​​​g​

属性是一个区域名称数组,用于指定在主内存中存储条目的区域。 默认情况下,如果未显式设置属性,则所有区域都使用主内存。​​regionNames​​​​regionNames​

或者,您可以使用文件中的 and 属性来设置 并配置这些注释属性的值。​​spring.data.gemfire.cache.off-heap.memory-size​​​​spring.data.gemfire.cache.off-heap.region-names​​​​application.properties​​​​@EnableOffHeap​

有关更多详细信息,请参阅@EnableOffHeap注释 Javadoc。

6.12.7. 配置磁盘存储

或者,您可以将区域配置为将数据保存到磁盘。您还可以将区域配置为溢出 逐出区域条目时的数据到磁盘。在这两种情况下,都需要持久化和/或溢出 数据。当尚未为具有持久性或溢出的区域配置显式时, Apache Geode使用。​​DiskStore​​​​DiskStore​​​​DEFAULT​​​​DiskStore​

我们建议在将数据保存到磁盘和/或溢出数据时定义特定于区域。​​DiskStores​

Spring Data for Apache Geode 通过注释注释应用程序类,为定义和创建应用程序区域提供了注释支持。​​DiskStores​​​​@EnableDiskStore​​​​@EnableDiskStores​

​@EnableDiskStores​​​是用于聚合一个或多个批注的复合批注。​​@EnableDiskStore​

例如,虽然信息可能主要由来自某些外部数据源的参考数据组成 (例如亚马逊),数据很可能本质上是事务性的,并且是应用程序的东西 将需要保留(如果交易量足够高,甚至可能溢出到磁盘)——或者说,无论如何,任何图书出版商和作者都希望如此。​​Book​​​​Order​

使用注释,您可以定义和创建以下内容的aas:​​@EnableDiskStore​​​​DiskStore​

Spring 应用程序定义​​DiskStore​

@SpringBootApplication
@PeerCacheApplication
@EnableDiskStore(name = "OrdersDiskStore", autoCompact = true, compactionThreshold = 70,
maxOplogSize = 512, diskDirectories = @DiskDiretory(location = "/absolute/path/to/order/disk/files"))
class ServerApplication { .. }

同样,通过使用复合,注释可以定义多个。​​DiskStore​​​​@EnableDiskStores​

与 Spring Data 中用于 Apache Geode 基于注释的配置模型的其他注释一样,两者都有许多属性以及相关的配置属性来自定义 在运行时创建。​​@EnableDiskStore​​​​@EnableDiskStores​​​​DiskStores​

此外,theannotation 定义了某些共同属性,这些属性适用于由 theannotation 本身组成的所有创建的 fromannotation。 单个配置覆盖特定的全局设置,但注释 方便地定义适用于所有按注释聚合的通用配置属性。​​@EnableDiskStores​​​​DiskStore​​​​DiskStores​​​​@EnableDiskStore​​​​@EnableDiskStores​​​​DiskStore​​​​@EnableDiskStores​​​​DiskStores​

Spring Data for Apache Geode 还提供了回调接口,可以在 Java 配置中声明。 代替配置属性来自定义 AAT 运行时,如以下示例所示:​​DiskStoreConfigurer​​​​DiskStore​

具有自定义磁盘存储配置的 Spring 应用程序

@SpringBootApplication
@PeerCacheApplication
@EnableDiskStore(name = "OrdersDiskStore", autoCompact = true, compactionThreshold = 70,
maxOplogSize = 512, diskDirectories = @DiskDiretory(location = "/absolute/path/to/order/disk/files"))
class ServerApplication {

@Bean
DiskStoreConfigurer ordersDiskStoreDiretoryConfigurer(
@Value("${orders.disk.store.location}") String location) {

return (beanName, diskStoreFactoryBean) -> {

if ("OrdersDiskStore".equals(beanName) {
diskStoreFactoryBean.setDiskDirs(Collections.singletonList(new DiskDir(location));
}
}
}
}

请参阅@EnableDiskStore和@EnableDiskStores注释 Javadoc 以获取有关可用属性以及相关配置属性的更多详细信息。

有关 Apache Geode Region 持久性和溢出(使用 DiskStores)的更多详细信息,请参阅此处。

6.12.8. 配置索引

除非可以访问数据,否则在区域中存储数据没有多大用处。

除了操作之外,特别是当事先知道密钥时,通常会检索数据 通过对包含数据的区域执行查询。使用 Apache Geode,查询是使用 对象查询语言 (OQL) 和客户端希望访问的特定数据集表示 在查询的谓词中(例如,)。​​Region.get(key)​​​​SELECT * FROM /Books b WHERE b.author.name = 'Jon Doe'​

通常,没有索引的查询效率低下。在没有索引的情况下执行查询时,Apache Geode 执行等效的全表扫描。

为查询谓词中使用的对象上的字段创建和维护索引,以匹配感兴趣的数据,如 由查询的投影表示。可以创建不同类型的索引,例如键索引和哈希索引。

Spring Data for Apache Geode 可以轻松地在存储和访问数据的区域上创建索引。而不是明确 像以前一样使用 Spring config 声明 bean 定义,我们可以在 Java 中创建 anbean 定义, 如下:​​Index​​​​Index​

使用 Java 配置的索引 Bean 定义

@Bean("BooksIsbnIndex")
IndexFactoryBean bookIsbnIndex(GemFireCache gemfireCache) {

IndexFactoryBean bookIsbnIndex = new IndexFactoryBean();

bookIsbnIndex.setCache(gemfireCache);
bookIsbnIndex.setName("BookIsbnIndex");
bookIsbnIndex.setExpression("isbn");
bookIsbnIndex.setFrom("/Books"));
bookIsbnIndex.setType(IndexType.KEY);

return bookIsbnIndex;
}

或者,我们可以使用XML来创建 anbean 定义,如下所示:​​Index​

使用 XML 的索引 Bean 定义

<gfe:index id="BooksIsbnIndex" expression="isbn" from="/Books" type="KEY"/>

但是,现在您可以直接在应用程序域对象类型的字段上定义索引,您知道 将在查询谓词中使用,以加快这些查询的速度。您甚至可以为生成的 OQL 查询应用索引 从应用程序存储库接口上的用户定义查询方法。

重用前面的示例实体类,我们可以注释我们知道使用的字段 在我们使用接口中的查询方法定义的查询中,如下所示:​​Book​​​​Book​​​​BookRepository​

使用索引对书籍进行建模的应用程序域对象类型

@Region("Books")
class Book {

@Id
private ISBN isbn;

@Indexed
private Author author;

private Category category;

private LocalDate releaseDate;

private Publisher publisher;

@LuceneIndexed
private String title;

}

在我们的newclass定义中,我们注释了字段withand thefield 跟。此外,该字段之前已经用Spring Data的sannotation进行了注释, 它标识包含实例唯一标识符的字段,并且在 Apache Geode 的 Spring 数据中,在存储条目时,注释字段或属性用作区域中的键。​​Book​​​​author​​​​@Indexed​​​​title​​​​@LuceneIndexed​​​​isbn​​​​@Id​​​​Book​​​​@Id​

  • ​@Id​​带注释的字段或属性会导致创建 Apache GeodeIndex。KEY
  • ​@Indexed​​带批注的字段或属性会导致创建 Apache GeodeIndex(默认值)。HASH
  • ​@LuceneIndexed​​带注释的字段或属性会导致创建 Apache Geode Lucene 索引,用于 基于文本的搜索,具有Apache Geode的Lucene集成和支持。

当使用注释而不设置任何属性时,索引 和 派生自已添加注释的类的字段或属性。这正是字段或属性的名称。泰斯派生自对 theannotation 域对象的类,或域对象类的简单名称(如果未指定注释)。​​@Indexed​​​​name​​​​expression​​​​fromClause​​​​@Indexed​​​​expression​​​​fromClause​​​​@Region​​​​@Region​

当然,您可以显式设置任何注释属性以覆盖默认值 由Spring Data for Apache Geode提供。​​@Indexed​

使用自定义索引对书籍建模的应用程序域对象类型

@Region("Books")
class Book {

@Id
private ISBN isbn;

@Indexed(name = "BookAuthorNameIndex", expression = "author.name", type = "FUNCTIONAL")
private Author author;

private Category category;

private LocalDate releaseDate;

private Publisher publisher;

@LuceneIndexed(name = "BookTitleIndex", destory = true)
private String title;

}

索引在未显式设置时自动生成,也用作 bean 的名称 在索引的 Spring 容器中注册。如有必要,甚至可以按名称注入此索引 bean 到另一个应用程序组件中。​​name​

生成的索引名称遵循以下模式: 例如,索引的名称将是,。​​<Region Name><Field/Property Name><Index Type>Idx​​​​author​​​​BooksAuthorHashIdx​

若要启用索引,请使用以下命令批注应用程序类:​​@EnableIndexing​

启用了索引的 Spring 应用程序

@SpringBootApplication
@PeerCacheApplication
@EnableEntityDefinedRegions
@EnableIndexing
class ServerApplication { .. }

除非也声明了注释,否则注释无效。 实质上,索引是从实体类类型的字段或属性定义的,并且必须扫描实体类 检查实体的字段和属性是否存在索引注释。如果没有此扫描,索引注释 找不到。我们还强烈建议您限制扫描范围。​​@EnablingIndexing​​​​@EnableEntityDefinedRegions​

虽然 Spring Data for Apache Geode 存储库(尚未)支持 Lucene 查询,但 SDG 确实为 Apache Geode 提供了全面的支持 Lucene 使用熟悉的 Spring 模板设计模式进行查询。

最后,我们在结束本节时要记住一些额外的提示,以便在使用索引时牢记:

  • 虽然执行 OQL 查询不需要 OQL 索引,但执行 Lucene 查询需要 Lucene 索引 基于文本的搜索。
  • OQL 索引不会持久保存到磁盘。它们仅在内存中维护。所以,当一个阿帕奇巨星 节点重新启动,必须重建索引。
  • 您还需要了解与维护索引相关的开销,特别是因为存储了索引 仅在内存中,尤其是在更新区域条目时。索引“维护”可以配置为异步任务。

重新启动 Spring 应用程序时可以使用的另一种优化,其中必须重建索引 是首先预先定义所有索引,然后一次创建所有索引,这在 Spring Data for Apache Geode 中发生 刷新 Spring 容器时。

您可以预先定义索引,然后通过将属性设置为 注释到。define@EnableIndexingtrue

有关更多详细信息,请参阅 Apache Geode 用户指南中的“一次创建多个索引”。

创建合理的索引是一项重要的任务,因为设计不佳的索引是可能的 弊大于利。

请参阅@Indexed注释 和@LuceneIndexed注释 Javadoc 获取配置选项的完整列表。

有关 Apache Geode OQL 查询的更多详细信息,请参见此处。

有关Apache Geode索引的更多详细信息可以在此处找到。

有关Apache Geode Lucene查询的更多详细信息,请参见此处。

6.13. 配置连续查询

Apache Geode的另一个非常重要和有用的功能是连续查询。

在互联网事物的世界里,事件和数据流来自四面八方。能够处理 处理大量数据流并对事件做出实时反应是一项越来越重要的要求 适用于许多应用。一个例子是自动驾驶汽车。能够接收、过滤、转换、分析、 实时处理数据是实时应用程序的关键区别和特征。

幸运的是,Apache Geode在这方面走在了时代的前面。通过使用连续查询 (CQ), 客户端应用程序可以表达它感兴趣的数据或事件,并注册侦听器以处理和处理 事件发生时的事件。客户端应用程序可能感兴趣的数据表示为 OQL 查询, 其中查询谓词用于筛选或标识感兴趣的数据。更改或添加数据时 并且它与已注册CQ的查询谓词中定义的条件匹配,则通知客户端应用程序。

Spring Data for Apache Geode 可以轻松定义和注册 CQ,以及用于处理和处理 CQ 的相关侦听器 没有Apache Geode管道的所有麻烦的事件。可持续发展目标基于注释的新配置 for CQ 基于连续查询侦听器容器中的现有连续查询支持构建。

例如,假设银行应用程序对每个客户的支票账户感兴趣,以检测透支。 通过应用透支保护或通知客户来提取和处理此事件。然后, 应用程序可能会注册以下 CQ:

具有注册CQ和侦听器的Spring应用程序。​​ClientCache​

@SpringBootApplication
@ClientCacheApplication(subcriptionEnabled = true)
@EnableContinuousQueries
class PublisherPrintApplication {

@ContinuousQuery(name = "OverdraftProtection", query = "SELECT * FROM /CheckingAccount ca WHERE ca.balance < 0.0")
void handleOverdraft(CqEvent event) {
// Quick!!! Put more money into the checking account or notify the customer of the checking account!
}
}

若要启用连续查询,请使用 对应用程序类进行批注。​​@EnableContinuousQueries​

定义连续查询包括注释任何 Spring 注释的 POJO 类方法 与注释(与SDG的功能注释POJO方法类似)。 使用注释用CQ定义的POJO方法称为任何时间数据匹配 添加或更改查询谓词。​​@Component​​​​@ContinuousQuery​​​​@ContinuousQuery​

此外,POJO 方法签名应遵循 ContinuQueryListener和ContinuQueryListenerAdapter 一节中概述的要求。

请参阅@EnableContinuousQueries和@ContinuousQuery注释 Javadoc 以获取有关可用属性和配置设置的更多详细信息。

有关 Spring Data for Apache Geode 持续查询支持的更多详细信息,请参见此处。

有关Apache Geode的连续查询的更多详细信息,请参见此处。

6.14. 配置 Spring 的缓存抽象

借助 Spring Data for Apache Geode,Apache Geode 可以用作 Spring 缓存抽象中的缓存提供程序。

在 Spring 的缓存抽象中,缓存注释(例如)标识缓存查找的缓存 在调用可能代价高昂的操作之前执行。缓存应用程序服务方法的结果 调用操作后。​​@Cacheable​

在 Apache Geode 的 Spring 数据中,Spring 直接对应于 Apache Geode 区域。该区域必须在之前存在 调用任何缓存批注的应用程序服务方法。对于任何 Spring 的缓存注释都是如此。 (即,和)标识要在服务操作中使用的缓存。​​Cache​​​​@Cacheable​​​​@CachePut​​​​@CacheEvict​

例如,我们的发布商的销售点 (PoS) 应用程序可能具有在销售交易期间确定或查找的功能,如以下示例所示:​​Price​​​​Book​

@Service
class PointOfSaleService

@Cacheable("BookPrices")
Price runPriceCheckFor(Book book) {
...
}

@Transactional
Receipt checkout(Order order) {
...
}

...
}

为了使您在将Spring Data for Apache Geode与Spring的缓存抽象一起使用时更轻松地工作,添加了两个新功能。 到基于注释的配置模型。

请考虑以下 Spring 缓存配置:

使用 Apache Geode 作为缓存提供程序启用缓存

@EnableCaching
class CachingConfiguration {

@Bean
GemfireCacheManager cacheManager(GemFireCache gemfireCache) {

GemfireCacheManager cacheManager = new GemfireCacheManager();

cacheManager.setCache(gemfireCache);

return cacheManager;
}

@Bean("BookPricesCache")
ReplicatedRegionFactoryBean<Book, Price> bookPricesRegion(GemFireCache gemfireCache) {

ReplicatedRegionFactoryBean<Book, Price> bookPricesRegion =
new ReplicatedRegionFactoryBean<>();

bookPricesRegion.setCache(gemfireCache);
bookPricesRegion.setClose(false);
bookPricesRegion.setPersistent(false);

return bookPricesRegion;
}

@Bean("PointOfSaleService")
PointOfSaleService pointOfSaleService(..) {
return new PointOfSaleService(..);
}
}

使用 Spring Data for Apache Geode 的新功能,您可以将相同的缓存配置简化为以下内容:

启用 Apache Geode 缓存

@EnableGemfireCaching
@EnableCachingDefinedRegions
class CachingConfiguration {

@Bean("PointOfSaleService")
PointOfSaleService pointOfSaleService(..) {
return new PointOfSaleService(..);
}
}

首先,theannotation取代了Springannotation和需要 在 Spring 配置中声明一个显式 bean 定义(名为 “cacheManager”)。​​@EnableGemfireCaching​​​​@EnableCaching​​​​CacheManager​

第二,theannotation,就像theannotation在 “配置区域”,检查整个 Spring 应用程序,缓存 带注释的服务组件,用于标识应用程序在运行时所需的所有缓存并创建 应用程序启动时这些缓存的 Apache Geode 中的区域。​​@EnableCachingDefinedRegions​​​​@EnableEntityDefinedRegions​

创建的区域是创建区域的应用程序进程的本地区域。如果应用程序是对等方, 区域仅存在于应用程序节点上。如果应用程序是,则 SDG 创建 clientRegions,并期望具有相同名称的区域已存在于集群中的服务器上。​​Cache​​​​ClientCache​​​​PROXY​

SDG 无法确定使用 Spring 解析运行时操作中使用的缓存的服务方法所需的缓存。​​CacheResolver​

SDG 还支持应用程序服务组件上的 JCache (JSR-107) 缓存注释。 请参阅核心 Spring框架参考指南,了解用于代替 JCache 缓存注解的等效 Spring 缓存注解。

有关更多详细信息,请参阅“对 Spring 缓存抽象的支持”部分 在 Spring 的缓存抽象中使用 Apache Geode 作为缓存提供程序。

有关 Spring 缓存抽象的更多详细信息可以在这里找到。

6.15. 配置集群配置推送

这可能是 Spring Data for Apache Geode 中最令人兴奋的新功能。

当客户端应用程序类被批注时,定义了任何区域或索引 并被客户端应用程序声明为 Spring 容器中的 bean 被“推送”到服务器集群 客户端连接到的。不仅如此,这种“推送”的执行方式是,Apache Geode 记住使用 HTTP 时客户端推送的配置。如果群集中的所有节点都出现故障,则它们 使用与以前相同的配置返回。如果将新服务器添加到群集,它将获取 相同的配置。​​@EnableClusterConfiguration​

从某种意义上说,此功能与使用Gfsh手动创建区域和索引没有太大区别 在群集中的所有服务器上。除了现在,有了 Spring Data for Apache Geode,你不再需要使用Gfsh来创建区域 和索引。您的Spring Boot应用程序,通过Spring Data for Apache Geode的强大功能启用,已经包含所有配置 为您创建区域和索引所需的元数据。

当您使用 Spring 数据存储库抽象时,我们知道所有区域(例如由带注释的实体类定义的区域)和索引(例如由带注释的实体字段和属性定义的区域) 您的应用程序将需要的。​​@Region​​​​@Indexed​

当您使用 Spring 的缓存抽象时,我们还知道缓存中标识的所有缓存的所有区域 应用程序的服务组件所需的注释。

从本质上讲,您已经告诉我们我们需要知道的一切,只需使用 Spring 框架只需使用其所有 API 和功能,无论是在注释元数据、Java、XML 中表达 或其他,无论是用于配置、映射还是任何目的。

关键是,您可以在使用框架的功能和支持的同时专注于应用程序的业务逻辑 基础设施(如 Spring 的缓存抽象、Spring 数据存储库、Spring 的事务管理、 等等),Spring Data for Apache Geode 负责这些框架功能所需的所有 Apache Geode 管道。 代表您。

将配置从客户端推送到群集中的服务器,并让群集记住它成为可能 部分通过使用Apache Geode的集群配置服务。Apache Geode的集群配置服务也是Gfsh用来记录的相同服务。 用户发布的与架构相关的更改(例如), 从命令行管理程序到群集。​​gfsh> create region --name=Example --type=PARTITION​

当然,由于集群可能会“记住”客户端从上一次运行中推送的先前配置, Spring Data for Apache Geode 小心翼翼地不要踩踏服务器中已经定义的任何现有区域和索引。 这一点尤其重要,例如,当区域已经包含数据时!

目前,没有覆盖任何现有区域或索引定义的选项。重新创建区域 或索引,则必须使用Gfsh首先销毁区域或索引,然后重新启动客户端应用程序 以便再次将该配置推送到服务器。或者,您可以使用Gfsh来(重新)定义区域 和手动索引。

Gfsh不同,Spring Data for Apache Geode仅支持从客户端在服务器上创建区域和索引。 对于高级配置和用例,您应该使用Gfsh来管理(服务器端)集群。

要使用此功能,您必须显式声明对 你的春天的类路径,阿帕奇大地测量应用。​​org.springframework:spring-web​​​​ClientCache​

考虑以下配置中表示的功率:

弹簧应用​​ClientCache​

@SpringBootApplication
@ClientCacheApplication
@EnableCachingDefinedRegions
@EnableEntityDefinedRegions
@EnableIndexing
@EnableGemfireCaching
@EnableGemfireRepositories
@EnableClusterConfiguration
class ClientApplication { .. }

您可以立即获得带有Apache Geodeinstance,Spring Data Repository的Spring Boot应用程序, Spring的缓存抽象,Apache Geode作为缓存提供程序(其中区域和索引 不仅在客户端上创建,而且推送到群集中的服务器)。​​ClientCache​

从那里,您只需要执行以下操作:

  • 定义使用映射和索引注释批注的应用程序域模型对象。
  • 定义存储库接口以支持每种实体类型的基本数据访问操作和简单查询。
  • 定义包含处理实体的业务逻辑的服务组件。
  • 在需要缓存、事务行为等的服务方法上声明适当的注释。

在这种情况下,与应用程序后端服务中所需的基础结构和管道无关 (如Apache Geode)。数据库用户具有类似的功能。现在Spring和Apache Geode开发人员也是如此。

当与以下用于Apache Geode注释的Spring Data结合使用时,该应用程序真正开始起飞, 毫不费力:

  • ​@EnableContinuousQueries​
  • ​@EnableGemfireFunctionExecutions​
  • ​@EnableGemfireCacheTransactions​

请参阅@EnableClusterConfiguration注释 Javadoc了解更多详情。

6.16. 配置 SSL

对于序列化要通过线路传输的数据同样重要的是在传输过程中保护数据。 当然,在 Java 中实现此目的的常用方法是使用安全套接字扩展 (SSE) 和传输层安全性 (TLS)。

若要启用 SSL,请使用以下命令批注应用程序类:​​@EnableSsl​

启用了 SSL 的 Spring应用程序​​ClientCache​

@SpringBootApplication
@ClientCacheApplication
@EnableSsl
public class ClientApplication { .. }

然后,您需要设置必要的 SSL 配置属性或属性:密钥库、用户名/密码等。

您可以单独配置不同的Apache Geode组件(,,,,和) 使用 SSL,或者可以使用枚举值将它们共同配置为使用 SSL。​​GATEWAY​​​​HTTP​​​​JMX​​​​LOCATOR​​​​SERVER​​​​CLUSTER​

您可以使用 SSL 配置设置指定应应用 Apache Geode 组件 嵌套注释,属性与枚举值来自枚举, 如下:​​@EnableSsl​​​​components​​​​Component​

通过组件启用SSL的Spring应用程序​​ClientCache​

@SpringBootApplication
@ClientCacheApplication
@EnableSsl(components = { GATEWAY, LOCATOR, SERVER })
public class ClientApplication { .. }

此外,还可以使用相应的注释属性或关联的配置属性指定组件级 SSL 配置 (,和/信息)。​​ciphers​​​​protocols​​​​keystore​​​​truststore​

有关更多详细信息,请参阅@EnableSsl注释 Javadoc。

有关Apache Geode SSL支持的更多详细信息,请参见此处。

6.17. 配置安全性

毫无疑问,应用程序安全性非常重要,Spring Data for Apache Geode提供了全面的支持 用于保护 Apache Geode 客户端和服务器。

最近,Apache Geode推出了一个新的集成安全框架。 (替换其旧的身份验证和授权安全模型)来处理身份验证和授权。 这个新安全框架的主要功能和好处之一是它与Apache Shiro集成,因此可以委派身份验证和授权请求 到阿帕奇四郎来加强安全性。

本节的其余部分将演示Spring Data for Apache Geode如何进一步简化Apache Geode的安全故事。

6.17.1. 配置服务器安全性

您可以通过多种不同的方式为 Apache Geode 集群中的服务器配置安全性。

  • 实现 Apache Geode接口并设置 Apache Geode 的属性以使用完全限定的 类名。或者,用户可以构造和初始化其实现的实例 并在创建 Apache Geode 对等体时使用CacheFactory.setSecurityManager(:SecurityManager)方法进行设置。org.apache.geode.security.SecurityManagersecurity-managerSecurityManagerSecurityManagerCache
  • 创建一个.ini包含用户、角色、 和为应用程序定义的权限,然后设置 Apache Geode属性 以引用此文件,该文件必须在 中可用。security-shiro-initshiro.iniCLASSPATH
  • 仅使用 Apache Shiro,使用 Spring Data 为 Apache Geode 的新注释注释您的 Spring Boot 应用程序类,并将一个或多个 Apache ShiroRealms定义为 Spring 容器中的 bean,用于访问应用程序的安全元数据(即授权用户、角色、 和权限)。@EnableSecurity

第一种方法的问题在于您必须实现自己的方法,这可能非常乏味 并且容易出错。实现自定义提供了从以下位置访问安全元数据的一定灵活性 存储元数据的任何数据源,例如 LDAP 甚至专有的内部数据源 数据源。但是,通过配置和使用Apache Shiro,这个问题已经解决了, 这是更广为人知和非阿帕奇Geode特定的。​​SecurityManager​​​​SecurityManager​​​​Realms​

请参阅 Apache Geode 的身份验证​和授权安全示例作为一种可能的方法 实现您自己的自定义、特定于应用程序。但是,我们强烈建议不要这样做。​​SecurityManager​

第二种方法,使用Apache Shiro INI文件,稍微好一点,但你仍然需要熟悉 首先是INI文件格式。此外,INI 文件是静态的,在运行时不容易更新。

第三种方法是最理想的,因为它遵循广为人知和行业接受的概念 (即 Apache Shiro 的安全框架)并且易于设置,如以下示例所示:

使用Apache Shiro的Spring服务器应用程序

@SpringBootApplication
@CacheServerApplication
@EnableSecurity
class ServerApplication {

@Bean
PropertiesRealm shiroRealm() {

PropertiesRealm propertiesRealm = new PropertiesRealm();

propertiesRealm.setResourcePath("classpath:shiro.properties");
propertiesRealm.setPermissionResolver(new GemFirePermissionResolver());

return propertiesRealm;
}
}

前面示例中显示的配置很可能是 Apache Shiro 支持的任何配置:​​Realm​​​​Realms​

  • 活动目录
  • 京东
  • 金迪
  • 目录
  • 支持INI 格式。Realm

您甚至可以创建Apache Shiro的自定义实现。Realm

有关更多详细信息,请参阅 Apache Shiro关于 Realms 的文档。

当 Apache Shiro 位于集群中的服务器上,并且一个或多个 Apache Shiro 在 Spring 容器中被定义为 bean 时,Spring Data for Apache Geode 会检测到此配置并使用 Apache Shiro 作为安全提供程序,在使用注释时保护您的Apache Geode服务器。​​CLASSPATH​​​​Realms​​​​@EnableSecurity​

您可以找到有关 Spring Data for Apache Geode 对 Apache Geode 新集成安全性的支持的更多信息 在这篇 spring.io 博客文章中使用 Apache Shiro 的框架。

请参阅@EnableSecurity注释 Javadoc 以获取有关可用属性和相关配置属性的更多详细信息。

有关Apache Geode安全性的更多详细信息可以在此处找到。

6.17.2. 配置客户端安全性

如果不讨论如何保护基于 Spring 的 Apache Geode 缓存客户端,安全故事将是不完整的。 应用程序也是如此。

老实说,Apache Geode保护客户端应用程序的过程相当复杂。简而言之,您需要:

  1. 提供org.apache.geode.security.AuthInitialize接口的实现。
  2. 设置 Apache Geode(System) 属性以引用应用程序提供的自定义接口。security-client-auth-initAuthInitialize
  3. 在专有的 Apache Geodefile 中指定用户凭据。gfsecurity.properties

Spring Data for Apache Geode 通过使用与服务器中使用的相同注释简化了所有这些步骤 应用。换句话说,相同的注释处理客户端和服务器的安全性 应用。此功能使用户在决定从嵌入式切换应用程序时更容易, 例如,对等应用程序到应用程序。只需更改可持续发展目标注释 弗洛尔托,你就完成了。​​@EnableSecurity​​​​@EnableSecurity​​​​Cache​​​​ClientCache​​​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@ClientCacheApplication​

实际上,您需要在客户端上执行的所有操作如下:

使用 Spring 客户端应用程序​​@EnableSecurity​

@SpringBootApplication
@ClientCacheApplication
@EnableSecurity
class ClientApplication { .. }

然后,您可以定义熟悉的 Spring 引导文件,其中包含所需的用户名和密码, 如以下示例所示,您已全部设置:​​application.properties​

具有所需安全凭据的 Spring 引导文件​​application.properties​

spring.data.gemfire.security.username=jackBlack
spring.data.gemfire.security.password=b@cK!nB1@cK

默认情况下,Spring Boot 可以在将文件放在 应用程序的。当然,Spring 支持许多通过使用其资源抽象​来定位资源的方法。​​application.properties​​​​CLASSPATH​

请参阅@EnableSecurity注释 Javadoc 以获取有关可用属性和相关配置属性的更多详细信息。

有关Apache Geode Security的更多详细信息,请参见此处。

6.18. 配置提示

以下提示可帮助您充分利用新的基于注释的配置模型:

  • 配置组织
  • 其他基于配置的注释

6.18.1. 配置组织

正如我们在“配置群集配置推送”一节中看到的, 当许多Apache Geode或Spring Data for Apache Geode功能通过使用注释启用时,我们开始堆叠很多 关于 Springorclass 的注释。在这种情况下,这是有道理的 开始对配置进行一些划分。​​@Configuration​​​​@SpringBootApplication​

例如,请考虑以下声明:

带厨房水槽的弹簧应用​​ClientCache​

@SpringBootApplication
@ClientCacheApplication
@EnableContinuousQueries
@EnableCachingDefinedRegions
@EnableEntityDefinedRegions
@EnableIndexing
@EnableGemfireCacheTransactions
@EnableGemfireCaching
@EnableGemfireFunctionExecutions
@EnableGemfireRepositories
@EnableClusterConfiguration
class ClientApplication { .. }

我们可以按关注点分解此配置,如下所示:

弹簧应用程序与基特肯水槽启动​​ClientCache​

@SpringBootApplication
@Import({ GemFireConfiguration.class, CachingConfiguration.class,
FunctionsConfiguration.class, QueriesConfiguration.class,
RepositoriesConfiguration.class })
class ClientApplication { .. }

@ClientCacheApplication
@EnableClusterConfiguration
@EnableGemfireCacheTransactions
class GemFireConfiguration { .. }

@EnableGemfireCaching
@EnableCachingDefinedRegions
class CachingConfiguration { .. }

@EnableGemfireFunctionExecutions
class FunctionsConfiguration { .. }

@EnableContinuousQueries
class QueriesConfiguration {

@ContinuousQuery(..)
void processCqEvent(CqEvent event) {
...
}
}

@EnableEntityDefinedRegions
@EnableGemfireRepositories
@EnableIndexing
class RepositoriesConfiguration { .. }

虽然这对 Spring 框架无关紧要,但我们通常建议以可读性为目标,为了 下一个必须维护代码的人(可能是将来某个时候的你)。

6.18.2. 其他基于配置的注释

本参考文档中未讨论以下可持续发展目标注释,因为 注释支持Apache Geode的已弃用功能,或者因为有更好的替代方法 要完成注释提供的功能,请执行以下操作:

  • ​@EnableAuth​​:启用 Apache Geode 的旧身份验证和授权安全模型。(已弃用。 Apache Geode的新集成安全框架可以通过使用SDG的sannotation在客户端和服务器上启用,如“配置安全性”中所述。@EnableSecurity
  • @EnableAutoRegionLookup:不推荐。本质上,此注释支持查找在外部定义的区域 配置元数据(例如应用于服务器时的群集配置)并自动 将这些区域注册为 Spring 容器中的 bean。此注释对应于 SDG 的 XML 命名空间中的元素。更多细节可以在这里找到。用户通常应 使用 Spring 和 Spring Data for Apache Geode 时首选 Spring 配置。请参阅“配置区域” 和“配置群集配置推送”。cache.xml<gfe:auto-region-lookup>
  • ​@EnableBeanFactoryLocator​​:启用仅有用的 SDG 功能 使用外部配置元数据时(例如,)。例如,如果您定义 aon 在 中定义的区域,您仍然可以使用在 Spring 配置中定义的关系数据库 Bean 自动连接它。此注释利用了此 SDG功能,如果您有大量旧版配置元数据,则此注释可能很有用, 如文件。GemfireBeanFactoryLocatorcache.xmlCacheLoadercache.xmlCacheLoaderDataSourcecache.xml
  • ​@EnableGemFireAsLastResource​​:在全局 - 与 Apache Geode 的JTA 事务管理中讨论。
  • @EnableMcast​:启用 Apache Geode 的旧对等发现机制,该机制使用基于 UDP 的多播网络。 (已弃用。请改用 Apache Geode 定位器。请参阅“配置嵌入式定位器”。
  • ​@EnableRegionDataAccessTracing​​:用于调试目的。此批注启用对所有数据访问的跟踪 通过注册 AOP 方面来代理声明为 bean 的所有区域的 AOP 方面,在区域上执行的操作 在 Spring 容器中,拦截区域操作并记录事件。

6.19. 结论

正如我们在前面的章节中学到的,Spring Data for Apache Geode新的基于注释的配置模型提供了巨大的 功率量。希望它能实现其目标,即在将Apache Geode与Spring一起使用时,您可以更轻松地快速轻松地入门

请记住,当您使用新的注释时,您仍然可以使用 Java 配置或 XML 配置。 您甚至可以通过在 Springorclass 上使用 Spring 的@Import和@ImportResource注释来组合所有三种方法。您明确提供的那一刻 一个bean定义,否则将由Spring Data for Apache Geode使用其中一个注释(基于注释)提供 配置后退。​​@Configuration​​​​@SpringBootApplication​


在某些情况下,您甚至可能需要回退到 Java 配置,就像在这种情况下一样,处理 更复杂或有条件的配置逻辑,不容易用 表示或无法通过 单独使用注释。不要惊慌。此行为是意料之中的。​​Configurers​



例如,需要Java或XML配置的另一种情况是在配置Apache Geode WAN组件时, 当前没有任何注释配置支持。但是,定义和注册 WAN 组件 只需要在 Springorclasses 的 Java 配置中使用 theandAPI 类(推荐)。​​org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean​​​​org.springframework.data.gemfire.wan.GatewaySenderFactoryBean​​​​@Configuration​​​​@SpringBootApplication​


注释并非旨在处理每种情况。这些注释旨在帮助您尽可能快速轻松地启动和运行,尤其是在开发过程中。

我们希望您会喜欢这些新功能!

6.20. 基于注释的配置快速入门

以下各节概述了可持续发展目标注释,以便快速入门。


所有注释都提供额外的配置属性以及相关​​属性​​,以方便地在运行时自定义 Apache Geode 的配置和行为。但是,总的来说, 使用特定的 Apache Geode 功能不需要任何属性或关联属性。 只需声明注释以启用该功能即可完成。参考 每个注释以获取更多详细信息。

6.20.1. 配置应用程序​​ClientCache​

要配置和引导 Apache Geodeapplication,请使用以下命令:​​ClientCache​

@SpringBootApplication
@ClientCacheApplication
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

参见@ClientCacheApplicationJavadoc。

有关更多详细信息,请参阅使用 Spring 配置 Apache Geode 应用程序。

6.20.2. 配置对等应用程序​​Cache​

要配置和引导 Apache Geode Peerapplication,请使用以下命令:​​Cache​

@SpringBootApplication
@PeerCacheApplication
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

如果要启用允许应用程序连接到此服务器, 然后简单地用theannotation替换theannotation。这将 在“本地主机”上开始运行,侦听默认端口。​​CacheServer​​​​ClientCache​​​​@PeerCacheApplication​​​​@CacheServerApplication​​​​CacheServer​​​​CacheServer​​​​40404​

参见@CacheServerApplicationJavadoc。

参见@PeerCacheApplicationJavadoc。

有关更多详细信息,请参阅使用 Spring 配置 Apache Geode 应用程序。

6.20.3. 配置嵌入式定位器

注释你的弹簧类开始 绑定到侦听默认定位器端口上的所有 NIC 的嵌入式定位器,如下所示:​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@EnableLocator​​​​10334​

@SpringBootApplication
@CacheServerApplication
@EnableLocator
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

​@EnableLocator​​只能与 Apache Geode 服务器应用程序一起使用。

参见@EnableLocatorJavadoc。

有关更多详细信息,请参阅配置嵌入式定位器。

6.20.4. 配置嵌入式管理器

注释你的弹簧类开始 绑定到侦听默认管理器端口的所有网卡的嵌入式管理器,如下所示:​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@EnableManager​​​​1099​

@SpringBootApplication
@CacheServerApplication
@EnableManager
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

​@EnableManager​​只能与 Apache Geode 服务器应用程序一起使用。

参见@EnableManagerJavadoc。

有关更多详细信息,请参阅配置嵌入式管理器。

6.20.5. 配置嵌入式 HTTP 服务器

注释你的弹簧类开始 侦听端口的嵌入式 HTTP 服务器 (Jetty),如下所示:​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@EnableHttpService​​​​7070​

@SpringBootApplication
@CacheServerApplication
@EnableHttpService
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

​@EnableHttpService​​只能与 Apache Geode 服务器应用程序一起使用。

参见@EnableHttpServiceJavadoc。

有关更多详细信息,请参阅配置嵌入式 HTTP 服务器。

6.20.6. 配置嵌入式内存缓存服务器

注释你的弹簧类开始 侦听端口的嵌入式 Memcached 服务器 (Gemcached),如下所示:​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@EnableMemcachedServer​​​​11211​

@SpringBootApplication
@CacheServerApplication
@EnableMemcachedServer
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

​@EnableMemcachedServer​​只能与 Apache Geode 服务器应用程序一起使用。

参见@EnableMemcachedServerJavadoc。

有关更多详细信息,请参阅配置嵌入式内存缓存服务器 (Gemcached)。

6.20.7. 配置嵌入式 Redis 服务器

注释你的弹簧类开始 侦听端口的嵌入式 Redis 服务器,如下所示:​​@PeerCacheApplication​​​​@CacheServerApplication​​​​@EnableRedisServer​​​​6379​

@SpringBootApplication
@CacheServerApplication
@EnableRedisServer
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

​@EnableRedisServer​​只能与 Apache Geode 服务器应用程序一起使用。

您必须在 Spring [Boot] 应用程序上显式声明模块 类路径。​​org.apache.geode:geode-redis​

参见@EnableRedisServerJavadoc。

有关更多详细信息,请参阅配置嵌入式 Redis 服务器。

6.20.8. 配置日志记录

要配置或调整 Apache Geode 日志记录,请注释您的 Spring、Apache Geode 客户端或服务器 应用程序类,如下所示:​​@EnableLogging​

@SpringBootApplication
@ClientCacheApplication
@EnableLogging(logLevel="trace")
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

默认为“配置”。此外,此注释不会调整应用程序中的日志级别, 仅适用于Apache Geode。​​log-level​

参见@EnableLoggingJavadoc。

有关更多详细信息,请参阅配置日志记录。

6.20.9. 配置统计

要在运行时收集 Apache Geode 统计信息,请注释您的 Spring、Apache Geode 客户端或服务器 应用程序类,如下所示:​​@EnableStatistics​

@SpringBootApplication
@ClientCacheApplication
@EnableStatistics
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

参见@EnableStatisticsJavadoc。

有关更多详细信息,请参阅配置统计信息。

6.20.10. 配置 PDX

要启用 Apache Geode PDX 序列化,请注释您的 Spring、Apache Geode 客户端或服务器 应用程序类,如下所示:​​@EnablePdx​

@SpringBootApplication
@ClientCacheApplication
@EnablePdx
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

Apache Geode PDX 序列化是 Java 序列化的替代方案,具有许多附加优势。首先, 它简化了使所有应用程序域模型类型可序列化而无需实现的工作。​​java.io.Serializable​

默认情况下,SDG 配置为序列化应用程序域模型类型, 不需要任何开箱即用的特殊配置即可正确识别应用程序域对象 需要序列化然后执行序列化,因为逻辑 INIS 基于 Spring Data的地图基础设施。有关更多详细信息,请参阅MappingPdxSerializer​。​​MappingPdxSerializer​​​​MappingPdxSerializer​

参见@EnablePdxJavadoc。

有关更多详细信息,请参阅配置 PDX。

6.20.11. 配置 SSL

要启用 Apache Geode SSL,请注释您的 Spring、Apache Geode 客户端或服务器应用程序类 与,如下所示:​​@EnableSsl​

@SpringBootApplication
@ClientCacheApplication
@EnableSsl(components = SERVER)
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

至少,Apache Geode要求您使用适当的配置指定密钥库和信任库。 属性或属性。密钥库和信任库配置属性或属性都可以引用同一个文件。此外,您需要指定用户名和密码才能访问文件 如果文件已得到保护。​​KeyStore​​​​KeyStore​

Apache Geode SSL允许您配置需要TLS的系统的特定组件,例如 客户端/服务器、定位器、网关等或者,您可以指定 Apache Geode 的所有组件 将 SSL 与“ALL”一起使用。

参见@EnableSslJavadoc。

有关更多详细信息,请参阅配置 SSL。

Apache Geode 的 Spring Data(数据)(三)_spring_02

6.20.12. 配置安全性

要启用 Apache Geode 安全性,请注释您的 Spring、Apache Geode 客户端或服务器应用程序类 与,如下所示:​​@EnableSecurity​

@SpringBootApplication
@ClientCacheApplication
@EnableSecurity
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

在服务器上,必须配置对身份验证凭据的访问。您可以实现 Apache GeodeSecurityManager​接口或声明 1 个或多个 Apache Shiro。有关更多详细信息,请参阅配置服务器安全性​。​​Realms​

在客户端上,必须配置用户名和密码。有关更多详细信息,请参阅配置客户端安全性。

参见@EnableSecurityJavadoc。

有关更多详细信息,请参阅配置安全性。

6.20.13. 配置 Apache Geode 属性

配置面向功能的 SDG 未涵盖的其他低级 Apache Geode 属性 配置注释,注释您的 Spring、Apache Geode 客户端或服务器应用程序类 与,如下所示:​​@GemFireProperties​

@SpringBootApplication
@PeerCacheApplication
@EnableGemFireProperties(
cacheXmlFile = "/path/to/cache.xml",
conserveSockets = true,
groups = "GroupOne",
remoteLocators = "lunchbox[11235],mailbox[10101],skullbox[12480]"
)
public class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}

某些 Apache Geode 属性仅位于客户端,而其他属性仅位于服务器端。请查看 Apache Geode文档用于适当使用 每个属性。

参见@EnableGemFirePropertiesJavadoc。

有关更多详细信息,请参阅配置 Apache Geode 属性。

6.20.14. 配置缓存

要使用Apache Geode作为Spring缓存抽象中的缓存提供程序, 并让 SDG 自动为您的应用程序所需的缓存创建 Apache Geode 区域 服务组件,然后注释您的 Spring、Apache Geode 客户端或服务器应用程序类 与,如下所示:​​@EnableGemfireCaching​​​​@EnableCachingDefinedRegions​

@SpringBootApplication
@ClientCacheApplication
@EnableCachingDefinedRegions
@EnableGemfireCaching
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

然后,只需继续定义需要缓存的应用程序服务,如下所示:

@Service
public class BookService {

@Cacheable("Books")
public Book findBy(ISBN isbn) {
...
}
}

​@EnableCachingDefinedRegions​​是可选的。也就是说,您可以根据需要手动定义区域。

参见@EnableCachingDefinedRegionsJavadoc。

参见@EnableGemfireCachingJavadoc。

有关更多详细信息,请参阅配置 Spring 的缓存抽象。

6.20.15. 为持久应用程序配置区域、索引、存储库和实体

为了缩短创建 Spring, Apache Geode 持久客户端或服务器应用程序的工作,请注释您的 应用程序类,以及,如下所示:​​@EnableEntityDefinedRegions​​​​@EnableGemfireRepositories​​​​@EnableIndexing​

@SpringBootApplication
@ClientCacheApplication
@EnableEntityDefinedRegions(basePackageClasses = Book.class)
@EnableGemfireRepositories(basePackageClasses = BookRepository.class)
@EnableIndexing
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

使用注释时需要注释。 有关更多详细信息,请参阅配置索引​。​​@EnableEntityDefinedRegions​​​​@EnableIndexing​

接下来,定义实体类并使用映射注释指定实体所在的区域 将被存储。使用注释在应用程序查询中使用的实体字段上定义索引, 如下:​​@Region​​​​@Indexed​

package example.app.model;

import ...;

@Region("Books")
public class Book {

@Id
private ISBN isbn;

@Indexed;
private Author author;

@Indexed
private LocalDate published;

@LuceneIndexed
private String title;

}

实体类注释由 the使用 确定 应用程序所需的区域。有关更多详细信息,请参阅配置特定于类型的区域​和POJO 映射​。​​@Region("Books")​​​​@EnableEntityDefinedRegions​

最后,使用要保留和访问的简单查询定义 CRUD 存储库,如下所示:​​Books​

package example.app.repo;

import ...;

public interface BookRepository extends CrudRepository {

List<Book> findByAuthorOrderByPublishedDesc(Author author);

}

有关更多详细信息,请参阅Spring Data for Apache Geode Repository。

参见@EnableEntityDefinedRegionsJavadoc。

参见@EnableGemfireRepositoriesJavadoc。

参见@EnableIndexingJavadoc。

参见@RegionJavadoc。

参见@IndexedJavadoc。

参见@LuceneIndexedJavadoc。

有关更多详细信息,请参阅配置区域。

有关更多详细信息,请参阅Spring Data for Apache Geode Repository。

6.20.16. 从集群定义的区域配置客户端区域

或者,您可以从集群中已定义的区域中定义客户端 [*代理] 区域 使用,如下所示:​​@EnableClusterDefinedRegions​

@SpringBootApplication
@ClientCacheApplication
@EnableClusterDefinedRegions
@EnableGemfireRepositories
public class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}

...
}

有关更多详细信息,请参阅配置的集群定义区域。

6.20.17. 配置函数

Apache Geode 函数在分布式计算方案中非常有用,在这些方案中,计算可能很昂贵 可以在群集中的节点之间并行执行请求数据。在这种情况下,效率更高 将逻辑带到数据所在的位置(存储),而不是请求和获取要处理的数据 通过计算。

使用与注释一起使用以启用Apache Geode函数 定义作为POJO上的方法实现,如下所示:​​@EnableGemfireFunctions​​​​@GemfireFunction​

@PeerCacheApplication
@EnableGemfireFunctions
class ServerApplication {

public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}

@GemfireFunction
Integer computeLoyaltyPoints(Customer customer) {
...
}
}

将 theand 与调用注释的函数 1 一起使用:,,,和。​​@EnableGemfireFunctionExecutions​​​​@OnMember​​​​@OnMembers​​​​@OnRegion​​​​@OnServer​​​​@OnServers​

@ClientCacheApplication
@EnableGemfireFunctionExecutions(basePackageClasses = CustomerRewardsFunction.class)
class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

@OnRegion("Customers")
interface CustomerRewardsFunctions {

Integer computeLoyaltyPoints(Customer customer);

}

参见@EnableGemfireFunctionsJavadoc。

参见@GemfireFunctionJavadoc。

参见@EnableGemfireFunctionExecutionsJavadoc。

参见@OnMemberJavadoc,@OnMembersJavadoc,@OnRegionJavadoc,@OnServerJavadoc, @OnServersJavadoc。

有关更多详细信息,请参阅函数执行的注释支持。

6.20.18. 配置连续查询

实时事件流处理正成为数据密集型应用程序越来越重要的任务, 主要是为了及时响应用户请求。Apache Geode Continuous Query (CQ) 将帮助您轻松完成这项相当复杂的任务。

通过注释您的应用程序类来启用 CQ,并定义您的 CQ 以及 关联的事件处理程序,如下所示:​​@EnableContinuousQueries​

@ClientCacheApplication
@EnableContinuousQueries
class ClientApplication {

public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}

然后,通过注释关联的处理程序方法来定义 CQ,如下所示:​​@ContinousQuery​

@Service
class CustomerService {

@ContinuousQuery(name = "CustomerQuery", query = "SELECT * FROM /Customers c WHERE ...")
public void process(CqEvent event) {
...
}
}

每当发生更改数据以匹配连续 OQL 查询 (CQ) 中的谓词的事件时, 该方法将被调用。​​Customer​​​​process​

Apache Geode CQ 只是客户端功能。

参见@EnableContinuousQueriesJavadoc。

参见@ContinuousQueryJavadoc。

有关更多详细信息,请参阅连续查询 (CQ) 和配置连续查询。

6.20.19. 配置集群配置

当使用Apache Geode作为Apache Geode应用程序开发Spring Data应用程序时,它是 在开发过程中,可用于配置服务器以匹配客户端/服务器拓扑中的客户端。事实上 Apache Geode 希望当您在客户端上具有“/示例”代理时,按名称匹配 (即“示例”)存在于服务器中。​​ClientCache​​​​Region​​​​Region​

您可以使用Gfsh创建应用程序所需的每个区域和索引,或者您可以简单地推送 使用 Apache Geode 开发 Spring 数据应用程序时已表示的配置元数据 当您运行它时。

这就像用以下方法注释主应用程序类一样简单:​​@EnableClusterConfiguration(..)​

用​​@EnableClusterConfiguration​

@ClientCacheApplication
@EnableClusterConfiguration(useHttp = true)
class ClientApplication {
...
}

大多数情况下,在使用客户端/服务器拓扑时,尤其是在生产环境中,服务器 的集群将使用Gfsh 启动。在这种情况下,习惯上使用HTTP(S)发送配置 集群的元数据(例如区域和索引定义)。使用 HTTP 时,将发送配置元数据 到集群中的管理器,并一致地分布在集群中的服务器节点上。

为了使用你必须声明依赖关系 在你的 Spring 应用程序类路径中。​​@EnableClusterConfiguration​​​​org.springframework:spring-web​

参见@EnableClusterConfigurationJavadoc。

有关更多详细信息,请参阅配置群集配置推送。

6.20.20. 配置​​GatewayReceivers​

在不同Apache Geode集群之间复制数据是一项越来越重要的容错能力。 和高可用性 (HA) 机制。Apache Geode WAN 复制是一种允许 Apache Geode 集群,以可靠且容错的方式将其数据复制到另一个 Apache Geode 集群 方式。

Apache Geode WAN 复制需要配置两个组件:

  • ​GatewayReceiver​​- 从远程 Apache Geode 集群接收数据的 WAN 复制组件。GatewaySender
  • ​GatewaySender​​- 将数据发送到远程 Apache Geode 集群的 WAN 复制组件。GatewayReceiver

要启用 a,需要对应用程序类进行注释,如下所示:​​GatewayReceiver​​​​@EnableGatewayReceiver​

@CacheServerApplication
@EnableGatewayReceiver(manualStart = false, startPort = 10000, endPort = 11000, maximumTimeBetweenPings = 1000,
socketBufferSize = 16384, bindAddress = "localhost",transportFilters = {"transportBean1", "transportBean2"},
hostnameForSenders = "hostnameLocalhost"){
...
...
}
}
class MySpringApplication { .. }

Apache Geode是服务器端功能,只能在aor对等节点上配置。​​GatewayReceiver​​​​CacheServer​​​​Cache​

参见@EnableGatewayReceiverJavadoc。

6.20.21. 配置​​GatewaySenders​

要启用,需要对应用程序类进行注释,并带有以下内容:​​GatewaySender​​​​@EnableGatewaySenders​​​​@EnableGatewaySender​

@CacheServerApplication
@EnableGatewaySenders(gatewaySenders = {
@EnableGatewaySender(name = "GatewaySender", manualStart = true,
remoteDistributedSystemId = 2, diskSynchronous = true, batchConflationEnabled = true,
parallel = true, persistent = false,diskStoreReference = "someDiskStore",
orderPolicy = OrderPolicyType.PARTITION, alertThreshold = 1234, batchSize = 100,
eventFilters = "SomeEventFilter", batchTimeInterval = 2000, dispatcherThreads = 22,
maximumQueueMemory = 400,socketBufferSize = 16384,
socketReadTimeout = 4000, regions = { "Region1"}),
@EnableGatewaySender(name = "GatewaySender2", manualStart = true,
remoteDistributedSystemId = 2, diskSynchronous = true, batchConflationEnabled = true,
parallel = true, persistent = false, diskStoreReference = "someDiskStore",
orderPolicy = OrderPolicyType.PARTITION, alertThreshold = 1234, batchSize = 100,
eventFilters = "SomeEventFilter", batchTimeInterval = 2000, dispatcherThreads = 22,
maximumQueueMemory = 400, socketBufferSize = 16384,socketReadTimeout = 4000,
regions = { "Region2" })
}){
class MySpringApplication { .. }
}

Apache Geode是服务器端功能,只能在对等节点上配置。​​GatewaySender​​​​CacheServer​​​​Cache​

在上面的示例中,应用程序配置了 2 个区域,并且。另外 两个将配置为为两个区域提供服务。将配置为复制将配置为复制“区域 2”的数据。​​Region1​​​​Region2​​​​GatewaySenders​​​​GatewaySender1​​​​Region1’s data and `GatewaySender2​

如所示,可以在每个注释上配置每个属性。​​GatewaySender​​​​EnableGatewaySender​

也可以采用更通用的“默认”属性方法,其中所有属性都配置为 注释。这样,就可以在父注释上设置一组通用的默认值 然后根据需要覆盖子项,如下所示:​​EnableGatewaySenders​

@CacheServerApplication
@EnableGatewaySenders(gatewaySenders = {
@EnableGatewaySender(name = "GatewaySender", transportFilters = "transportBean1", regions = "Region2"),
@EnableGatewaySender(name = "GatewaySender2")},
manualStart = true, remoteDistributedSystemId = 2,
diskSynchronous = false, batchConflationEnabled = true, parallel = true, persistent = true,
diskStoreReference = "someDiskStore", orderPolicy = OrderPolicyType.PARTITION, alertThreshold = 1234, batchSize = 1002,
eventFilters = "SomeEventFilter", batchTimeInterval = 2000, dispatcherThreads = 22, maximumQueueMemory = 400,
socketBufferSize = 16384, socketReadTimeout = 4000, regions = { "Region1", "Region2" },
transportFilters = { "transportBean2", "transportBean1" })
class MySpringApplication { .. }

当属性留空或未填充时,将自动附加 本身到应用程序中的每个配置。​​regions​​​​GatewaySender​​​​Region​

参见@EnableGatewaySendersJavadoc和@EnableGatewaySenderJavadoc。

7. 使用 Apache Geode API

配置 Apache Geode 缓存和区域后,可以在应用程序对象中注入和使用它们。 本章描述了与 Spring 的交易管理功能和 DAO 异常层次结构的集成。 本章还介绍了对 Apache Geode 托管对象的依赖关系注入的支持。

7.1. 宝石火模板

与 Spring 提供的许多其他高级抽象一样,Spring Data for Apache Geode 提供了一个模板来简化 Apache Geode 数据访问操作。该类提供了几个包含常见区域操作的方法, 但也提供了针对本机 Apache Geode API执行代码的能力,而无需处理 Apache Geode 使用 a 检查异常。​​GemfireCallback​

模板类需要 Apache Geode,一旦配置,它是线程安全的,并且可以重用 跨多个应用程序类:​​Region​

<bean id="gemfireTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="SomeRegion"/>

配置模板后,开发人员可以同时使用它直接使用 Apache Geode无需处理检查异常、线程或资源管理问题:​​GemfireCallback​​​​Region​

template.execute(new GemfireCallback<Iterable<String>>() {

public Iterable<String> doInGemfire(Region region)
throws GemFireCheckedException, GemFireException {

Region<String, String> localRegion = (Region<String, String>) region;

localRegion.put("1", "one");
localRegion.put("3", "three");

return localRegion.query("length < 5");
}
});

为了访问Apache Geode查询语言的全部功能,开发人员可以使用theandmethods,与该方法相比,它可以跨多个区域执行查询,执行投影, 等等。​​find​​​​findUnique​​​​query​

当查询选择多个项目(通过)时,应使用该方法,顾名思义,当只返回一个对象时,应使用该方法。​​find​​​​SelectResults​​​​findUnique​

7.2. 异常翻译

使用新的数据访问技术不仅需要适应新的 API,还需要处理异常 特定于该技术。

为了适应异常处理情况,Spring 框架提供了一个与技术无关且一致的异常层次结构,该层次结构将应用程序从专有的、通常“检查”的异常中抽象为一组集中的运行时。 异常。

正如Spring Framework文档中提到的,通过使用注释和AOP,异常转换​可以透明地应用于您的数据访问对象(DAO)。 通过定义阿豆。相同的异常转换功能 在使用 Apache Geode 时启用,只要声明了这些,例如使用 aordeclaration,它充当异常转换器并自动检测 弹簧基础设施并相应地使用。@RepositoryPersistenceExceptionTranslationPostProcessorCacheFactoryBean<gfe:cache/><gfe:client-cache>

7.3. 本地缓存事务管理

Spring 框架最流行的功能之一是事务管理。

如果您不熟悉Spring的事务抽象,那么我们强烈建议您阅读Spring​的事务管理基础架构,因为它提供了一致的编程模型。 跨多个 API 透明,可以通过编程或声明方式进行配置 (最受欢迎的选择)。

对于 Apache Geode,Spring Data for Apache Geode 提供了一个专用的、每缓存的缓存,一旦声明, 允许通过 Spring 原子方式执行区域操作:​​PlatformTransactionManager​

使用 XML 启用事务管理

<gfe:transaction-manager id="txManager" cache-ref="myCache"/>

上面的示例可以通过消除属性来进一步简化,如果 Apache Geode 缓存在默认名称下定义。与Apache Geode命名空间元素的其他Spring Data一样,如果缓存 未配置 Bean 名称,将使用上述命名约定。此外,事务管理器 名称为“gemfireTransactionManager”(如果未明确指定)。​​cache-ref​​​​gemfireCache​

目前,Apache Geode 支持具有读取提交隔离的乐观事务。此外,为了保证 这种隔离,开发人员应避免进行手动修改缓存中存在的值的就地更改。 为了防止这种情况发生,事务管理器将缓存配置为默认使用读取时复制语义, 这意味着每次执行读取时都会创建实际值的克隆。如果需要,可以禁用此行为 通过该物业。​​copyOnRead​

由于给定键的值的副本是在启用读取时复制时创建的,因此随后必须调用 order,以便以事务方式更新值。​​Region.put(key, value)​

有关底层 Geode 事务管理器的语义和行为的更多信息,请参阅 GeodeCacheTransactionManager Javadoc以及文档。

7.4. 全球、JTA 事务管理

Apache Geode也可以参与基于JTA的全局事务,例如事务 由 Java EE 应用程序服务器(例如 WebSphere Application Server (WAS))使用容器管理事务进行管理 (CMT)以及其他JTA资源。

但是,与许多其他JTA“兼容”资源(例如像ActiveMQ这样的JMS消息代理)不同,Apache Geode不是XA兼容资源。因此,Apache Geode 必须定位为 JTA 事务中的“最后一个资源” (准备阶段),因为它不实现两阶段提交协议,或者更确切地说,不处理分布式 交易。

许多能够进行 CMT 的托管环境在基于 JTA 时保持对“最后资源”、不符合 XA 的资源的支持 事务,尽管 JTA 规范中实际上并不需要它。有关不符合 XA 标准的更多信息, “最后的资源”是指可以在红帽的文档​中找到。 事实上,Red Hat的JBoss项目Narayana​就是这样一个LGPL开源实现。Narayana将其称为“上次资源提交优化”(LRCO)。更多细节可以在这里找到。

但是,您是否在具有开源JTA事务的独立环境中使用Apache Geode。 支持“最后资源”或托管环境(例如 Java EE AS,如 WAS)的管理实现, Apache Geode的Spring Data可以满足您的需求。

您必须完成一系列步骤才能正确使用 Apache Geode 作为 JTA 中的“最后资源” 涉及 1 个以上事务资源的事务。此外,只能有 1 个不符合 XA 的资源 (例如Apache Geode)在这样的安排中。

1) 首先,您必须在此处完成 Apache Geode 文档中的步骤 1-4。

上面的 #1 独立于您的 Spring [Boot] 和/或 [Apache Geode 数据] 应用程序,并且必须 成功完成。

2)参考Apache Geode文档中​的步骤5, Spring Data for Apache Geode的注解支持将尝试在使用注解时为你设置copyOnRead属性。​​GemFireCache​​​​@EnableGemFireAsLastResource​

但是,如果 SDG 的自动配置在这方面不成功,则必须在 theorXML 元素中显式设置属性或设置 theclass in JavaConfig totrue。例如:​​copy-on-read​​​​<gfe:cache>​​​​<gfe:client-cache>​​​​copyOnRead​​​​CacheFactoryBean​

​ClientCache​​.XML:

使用 XML(客户端)设置读取时复制

<gfe:client-cache ... copy-on-read="true"/>

​ClientCache​​ JavaConfig

使用 JavaConfig 设置 copyOnRead (客户端)

@Bean
ClientCacheFactoryBean gemfireCache() {

ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();

gemfireCache.setCopyOnRead(true);

return gemfireCache;
}

PeerXML:​​Cache​

使用 XML(服务器)设置读取时复制

<gfe:cache ... copy-on-read="true"/>

PeerJavaConfig:​​Cache​

使用 JavaConfig 设置 copyOnRead(服务器)

@Bean
CacheFactoryBean gemfireCache() {

CacheFactoryBean gemfireCache = new CacheFactoryBean();

gemfireCache.setCopyOnRead(true);

return gemfireCache;
}

显式设置属性或属性确实没有必要。使 事务管理采用读取时复制的情况。​​copy-on-read​​​​copyOnRead​

3)此时,您跳过Apache Geode文档中的步骤6-8,让Spring Data Geode发挥其魔力。您需要做的就是注释您的 Springclass 使用Spring Data for Apache Geode的新注释以及Spring的事务管理基础设施和Spring Data for Apache Geode的sannotation配置的组合就可以解决问题。​​@Configuration​​​​@EnableGemFireAsLastResource​​​​@EnableGemFireAsLastResource​

配置如下所示...

@Configuration
@EnableGemFireAsLastResource
@EnableTransactionManagement(order = 1)
class GeodeConfiguration {
...
}

唯一的要求是...

3.1) 注释必须在同一个 Spring 类上声明 其中还指定了春天的三注。​​@EnableGemFireAsLastResource​​​​@Configuration​​​​@EnableTransactionManagement​

3.2)注释的属性必须显式设置为整数值 即 notor(默认为)。​​order​​​​@EnableTransactionManagement​​​​Integer.MAX_VALUE​​​​Integer.MIN_VALUE​​​​Integer.MAX_VALUE​

当然,希望您知道在使用这样的JTA事务时,您还需要配置Spring。​​JtaTransactionManager​

@Bean
public JtaTransactionManager transactionManager(UserTransaction userTransaction) {

JtaTransactionManager transactionManager = new JtaTransactionManager();

transactionManager.setUserTransaction(userTransaction);

return transactionManager;
}

本地,缓存事务管理部分中的配置不适用于此处。 将 Spring Data 用于 Apache Geode'sis 适用于“仅限本地”、缓存事务,而不是“全局”、JTA 事务。因此,在这种情况下,您不会配置 SDG。 您可以配置Spring的如上所示。​​GemfireTransactionManager​​​​GemfireTransactionManager​​​​JtaTransactionManager​

有关将Spring 的事务管理与 JTA 一起使用的更多详细信息, 看这里。

实际上,Apache Geode'sannotation的Spring Data导入了包含2个方面的配置 在事务操作期间的适当点处理 Apache GeodeandOperations 的 Bean 定义。​​@EnableGemFireAsLastResource​​​​o.a.g.ra.GFConnectionFactory.getConnection()​​​​o.a.g.ra.GFConnection.close()​

具体而言,正确的事件顺序如下:

  1. ​jtaTransation.begin()​
  2. ​GFConnectionFactory.getConnection()​
  3. 调用应用程序的服务方法@Transactional
  4. 乔尔jtaTransaction.commit()jtaTransaction.rollback()
  5. 最后GFConnection.close()

这与作为应用程序开发人员,如果您必须使用 JTA API 手动编写代码的方式一致。 + Apache Geode API 自己,如 Apache Geode示例。

值得庆幸的是,Spring为您完成了繁重的工作,并且在应用适当的配置后您需要做的所有事情 (如上所示)为:

将服务方法声明为@Transactional

@Service
class MyTransactionalService {

@Transactional
public <Return-Type> someTransactionalServiceMethod() {
// perform business logic interacting with and accessing multiple JTA resources atomically
}

...
}

上面的#1和#4由Spring的JTA适当地为您处理,一旦您的应用程序输入边界(即当调用时)。​​PlatformTransactionManager​​​​@Transactional​​​​MyTransactionService.someTransactionalServiceMethod()​

#2 和 #3 由 Spring Data 处理,用于 Apache Geode 启用注释的新方面。​​@EnableGemFireAsLastResource​

#3当然是您的应用程序的责任。

事实上,通过配置适当的日志记录,您将看到正确的事件顺序......

事务日志输出

2017-Jun-22 11:11:37 TRACE TransactionInterceptor - Getting transaction for [example.app.service.MessageService.send]

2017-Jun-22 11:11:37 TRACE GemFireAsLastResourceConnectionAcquiringAspect - Acquiring {data-store-name} Connection
from {data-store-name} JCA ResourceAdapter registered at [gfe/jca]

2017-Jun-22 11:11:37 TRACE MessageService - PRODUCER [ Message :
[{ @type = example.app.domain.Message, id= MSG0000000000, message = SENT }],
JSON : [{"id":"MSG0000000000","message":"SENT"}] ]

2017-Jun-22 11:11:37 TRACE TransactionInterceptor - Completing transaction for [example.app.service.MessageService.send]

2017-Jun-22 11:11:37 TRACE GemFireAsLastResourceConnectionClosingAspect - Closed {data-store-name} Connection @ [Reference [...]]

有关使用 Apache Geode 缓存级事务的更多详细信息,请参阅此处。

有关在 JTA 事务中使用 Apache Geode 的更多详细信息, 看这里。

有关将 Apache Geode 配置为“最后资源”的更多详细信息, 看这里。

标签:配置,Spring,Geode,应用程序,注释,Apache
From: https://blog.51cto.com/u_15326439/5878298

相关文章