Closed jaimearroyo7 closed 2 years ago
I think it is possible to do so. I would write a result converter that would convert Map<K, V> to whatever you want. Just make it extendable enough to be able to write custom converters
@jaimearroyo7 I'll look into this asap, also @prokop7 is right that it should be doable. I'll also improve the existing CollectionCreator
usage as well.
@jaimearroyo7 I've pushed to master a first solution supporting List<MyEntity>
return types. However, the class MyEntity
must implement the support interface HasCacheKey
, which returns an object of the same type as the passed in ids
items (in your case, it's probably the entity id of type Long
).
Please try out the snapshot version for your use case. If you find it useful as it is, I'll release it as 1.3.0, if not, please report what could be improved.
@neiser Thank you very much for your reply! I will take a look, play with it and tell you something ASAP!!
Hey! I'm getting a java.lang.IllegalStateException: Cannot find appropriate return value converter for method public java.util.List ........ Available are: [de.qaware.tools.collectioncacheableforspring.returnvalue.DefaultReturnValueConverter@2ff452dd]
am I missing something?
MyEntity already implements HasCacheKey
with public Object getCacheKey() {return id;}
@jaimearroyo7 I forgot to add the bean in the auto configuration. I've just pushed a fixed and the newest -SNAPSHOT
release should hopefully work for you.
It's working now, thank you very much!! 🎉 🎉 🎉
I think it can be released as 1.3.0! 🚀
Hey @neiser !! Have you been able to publish it already? I'd like to use it as maven dependecy 😅 😅 😅 . But no hurry of course, it's your project!!
@jaimearroyo7 I've just released it as 1.3.0. Sorry for being slow with this, but I was a little bit concerned about the performance implications of my change. But anyhow, that can be improved in future releases. There's no reason to hold this feature back.
Hey @neiser ! First of all thank you for this project, it's really nice.
My question here is if there is any way to make it work in functions like this?
If not, is there any way I could contribute to make this possible? It would be really useful to be able to do so.