We’re giving away 1,500 more DJI Tello drones. Enter to win ›
Paul Bennett, Billy Korando | Updated February 24, 2019 - Published July 25, 2017
In this tutorial, learn how to access a Compose for Redis caching service on IBM Cloud from a Spring Boot application.
Redis is a popular open source in-memory database implementing a networked, in-memory key-value store.
Spring Boot is a popular library that offers an opinionated take of the Spring Framework that allows for the rapid development and deployment of production-ready Spring applications.
When the service is fully deployed, which can take several minutes, you should see an overview screen similar to the following:
Download or clone this git repo from the Messaging with Redis Spring guide project:
git clone https://github.com/spring-guides/gs-messaging-redis
Under the folder complete/src/main/resources/, create the file application.properties. By default, Spring Boot will configure a Redis connection pointing to localhost:6379. To connect to the IBM Cloud Redis service, in application.properties, add the property spring.redis.url with the connection string to your Redis service. Using the above example, the application.properties file will look like this:
Under the complete folder, issue the following commands to build and run the application:
mvn clean install
java -jar target/gs-messaging-redis-0.1.0.jar
You should see the following output:
It’s that simple to create a Spring Boot application to access a Redis service on IBM Cloud! In my next tutorial, I’ll show you how to run the app on an IBM Cloud Kubernetes cluster using Kubernetes secrets to configure the service credentials.
Learn how to use Spring Kafka to access an IBM Event Streams service on IBM Cloud.
May 16, 2019
March 27, 2019
Back to top