I am using Spring Redis support to save my objects in Redis.
I have several DAOs which handle different Model classes:
For example, ShopperHistoryDao>
Yes, the RedisTemplate seems to be designed to have a single instance of the value serializer.
I was going to suggest the possible workaround of having a RedisSerializer
which contains a Map of inner serializers so you can use one RedisTemplate
with a serializer that can handle multiple types - but since RedisSerializer
does not offer methods like boolean canDeserialize(..)
(as the HTTP MessageConverters in Spring MVC have) this doesn't seem possible.
So it seems that you are stuck with having multiple RedisTemplate
instances.