备注
基本标准计划于 2025 年 3 月 17 日进入退休期。 有关详细信息,请参阅 Azure Spring Apps 停用公告。
标准消耗和专用计划于 2024 年 9 月 30 日进入停用期,并将在 2025 年 3 月底之前完全关闭。
可以通过 Azure Spring Apps 将所选 Azure 服务自动连接到应用程序,而不必手动配置 Spring Boot 应用程序。 本文介绍如何将应用程序连接到 Azure Redis 缓存。
- 部署的 Azure Spring Apps 实例
- Azure Redis 缓存服务实例
- 用于 Azure CLI 的 Azure Spring Apps 扩展
如果没有已部署的 Azure Spring Apps 实例,请按照快速入门:将第一个应用程序部署到 Azure Spring Apps 中的步骤操作。
在项目的 pom.xml 文件中,添加以下依赖项:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis-reactive</artifactId> </dependency>
从 application.properties 文件中,删除所有
spring.redis.*
属性使用
az spring app update
更新当前部署,或者使用az spring app deployment create
创建新的部署。
本文介绍了如何将 Azure Spring Apps 中的应用程序连接到 Azure Cache for Redis。 若要详细了解如何将服务连接到应用程序,请参阅连接到 Azure Database for MySQL 实例。