This article explains using the Spring Boot application with multiple data sources.

I am using Spring Boot 2.3.0.RELEASE and database as Postgres, pre-requisites are Postgres database and Redis running already.

Lets get started by adding below dependencies to your pom.xml file

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>3.3.0</version>
</dependency>

#redis #spring-boot #spring-jpa #postgres #database

How to use Database and Redis with Spring Boot JPA
16.35 GEEK