Connect Azure Cache for Redis to your application in Azure Spring Apps

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps.

Instead of manually configuring your Spring Boot applications, you can automatically connect selected Azure services to your applications by using Azure Spring Apps. This article shows how to connect your application to Azure Cache for Redis.

Prerequisites

  • A deployed Azure Spring Apps instance
  • An Azure Cache for Redis service instance
  • The Azure Spring Apps extension for the Azure CLI

If you don't have a deployed Azure Spring Apps instance, follow the steps in the Quickstart: Deploy your first application to Azure Spring Apps.

Prepare your project

  1. Add the following dependency to your project's pom.xml file:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
    </dependency>
    
  2. Remove any spring.redis.* properties from the application.properties file

  3. Update the current deployment using az spring app update or create a new deployment using az spring app deployment create.

Connect your app to the Azure Cache for Redis

Next steps

In this article, you learned how to connect your application in Azure Spring Apps to Azure Cache for Redis. To learn more about connecting services to your application, see Connect to an Azure Database for MySQL instance.