第 3 章 在服务器模式下运行


使用 Hot Rod (一个自定义 TCP 二进制线协议)从远程 Data Grid 集群存储和检索数据。

3.1. 设置 RemoteCacheManager

  1. 提供 Data Grid 服务器的位置,以便初学者可以创建 RemoteCacheManager bean。

    初学者首先会尝试在 hotrod-client.properties 中找到服务器位置,然后从 application.properties 中查找服务器位置。

  2. 使用 Spring @Autowired 注解在应用程序中包含您自己的自定义缓存管理器类:

    private final RemoteCacheManager cacheManager;
    
    @Autowired
    public YourClassName(RemoteCacheManager cacheManager) {
        this.cacheManager = cacheManager;
    }

热 Rod 客户端属性

在 classpath 上的 hotrod-client.properties 中指定客户端配置,例如:

# List Infinispan or Data Grid servers by IP address or hostname at port 11222.
infinispan.client.hotrod.server_list=127.0.0.1:6667

如需更多信息,请参阅 org.infinispan.client.hotrod.configuration

应用程序属性

使用 application.properties 配置项目。如需更多信息,请参阅 应用程序属性

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部