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)?