-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
HashOperations not being autowired [DATAREDIS-8] #586
Comments
Andrew Berman commented Here's the exception: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.data.keyvalue.redis.core.HashOperations] found for dependency |
Costin Leau commented What's your configuration. It works in our test suite for the following config:
Where RedisViewPE has setter
|
Andrew Berman commented I followed the documentation (though I'm using Java-based config): Config:
Bean:
This is how the documentation shows it. But now I see you're doing things differently. You're injecting hashOps manually with redisTemplate, so I guess that's what I need to do. Can you update the documentation to reflect this? Or should it work the way I have it and I'm doing something wrong? |
Costin Leau commented The docs might need updating. Can you add a qualifier when injecting the hashOps and see whether it changes the situation (autowiring doesn't do any conversion unless told so): |
Costin Leau commented To add, you could also use |
Andrew Berman commented This is the error I get when using Qualifier: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.data.keyvalue.redis.core.HashOperations] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: { This is the error with Resource(name="redisTemplate"): Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'redisTemplate' must be of type [org.springframework.data.keyvalue.redis.core.HashOperations], but was actually of type [org.springframework.data.keyvalue.redis.core.RedisTemplate] Error with just Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.springframework.data.keyvalue.redis.core.HashOperations] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: { |
Costin Leau commented Hi Andrew, Sorry for the late reply - I've actually investigated this issue after you reported it but forgot to add a comment. I'm not sure whether the fix will make it into 3.0.6 but it should into the 3.1 branch |
Andrew Berman commented Cool, thanks Costin! |
Costin Leau commented Seems the issue has been fixed in Spring 3.0.6 and 3.1.RC1 |
Andrew Berman opened DATAREDIS-8 and commented
The documentation states that if you inject the RedisTemplate it should automatically convert to the proper operation. It doesn't do it for HashOperations. If that is by design due to the added key in the hash then the documentation should be updated
Affects: 1.0.0.M3
Referenced from: commits a6f79e2
The text was updated successfully, but these errors were encountered: