Using Spring cache annotation in multiple modules

前端 未结 5 1954
小蘑菇
小蘑菇 2020-12-23 20:56

I have a util module that produces a jar to be used in other applications. I\'d like this module to use caching and would prefer to use Spring\'s annotation-driven

5条回答
  •  一个人的身影
    2020-12-23 21:16

    Spring currently expects the cacheManager to be a Singleton. This is something that the ehcache-spring-annotations project ran into and I've yet to see the request fulfilled. http://code.google.com/p/ehcache-spring-annotations/issues/detail?id=76

    As with all things Java and Spring you do have the option to reimplement the class.

    http://forums.terracotta.org/forums/posts/list/5618.page#27960 provides a base explanation of what some people have come up with as a workaround and

    • http://itcb.svn.sourceforge.net/viewvc/itcb/addons/itcb-cache/trunk/
    • http://itcb.svn.sourceforge.net/.../itcb/addons/cachemanager/

    Is the actual code they came up with. The approach does create a convention to follow but it would be easy enough to reimplement this with your own version if you do not like the actual approach described.

提交回复
热议问题