Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Using mongo and redis cache with both repositories in Spring Boot

$
0
0

I want to use both Redis and Mongo with repository manner (I do not want to use spring cache annotations but repository methods).

I annotate the main class with the following annotations.

@EnableMongoRepositories(basePackageClass = PersistencyRepository.class)@EnableRedisRepositories(basePackageClass = CacheRepository.class)@SpringBootApplication

Repos

public interface PersistencyRepository extends CrudRepository<Store, String> {}public interface CacheRepository extends MongoRepository<Store, String> {}

Now, I am getting the following error.

The bean "cacheRepository" defined in com.repository.CacheRepository defined in @EnableMongoRepositories declared on StoreApplication, could not be registered. A bean with that name has already been defined in com.repository.CacheRepository defined in @EnableRedisRepositories declared on StoreApplication and overriding is disabled. 

How can I use repos of differenet databases (mongo, redis)?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>