Skip to content

Could not safely identify store assignment Spring Data Redis #3261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SaliniJoby opened this issue Mar 25, 2025 · 2 comments
Open

Could not safely identify store assignment Spring Data Redis #3261

SaliniJoby opened this issue Mar 25, 2025 · 2 comments
Assignees
Labels
status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged

Comments

@SaliniJoby
Copy link

Spring Data Redis - Could not safely identify store assignment for
repository candidate interface com.xxx.xxxx.api.mongodb.repository.ABCMongoRepository;
If you want this repository to be a Redis repository, consider annotating your entities
with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred),
or consider extending one of the following types with your repository:
org.springframework.data.keyvalue.repository.KeyValueRepository

Note:

  1. Getting this error for Mongo Repository classes only even though we have Postgres Repo as well
  2. These 2 annotations are already in place.
    @EnableJpaRepositories(basePackages = "com.xxx.xxxx.repository")
    @EnableMongoRepositories(basePackages = "com.xxx.xxxx.api.mongodb.repository")
  3. Started getting this error when we introduced Redis as cache solution.
  4. It is failing only in azure AKS. in local even when we connected to azure cosmos it is working fine.

Can anyone pls suggest.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 25, 2025
@mp911de mp911de self-assigned this Apr 7, 2025
@mp911de
Copy link
Member

mp911de commented Apr 7, 2025

This is because @EnableRedisRepositories is set implicitly and Redis scans all repositories at the application base package. You can either disable Spring Data Redis Repositories or point it to a non-existant package with @EnableRedisRepositories.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Apr 7, 2025
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants