Problems with ehcache:annotation-driven and spring 3.0.5 component scan
720 views
Skip to first unread message
Jonas
unread,
Mar 23, 2011, 7:08:50 AM3/23/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ehcache Spring Annotations
Hey guys,
I have a problem configuring Spring 3.0.5 with ehcache:annotation
driven.
If I configure the ehcache, Autowireing of all beans including a
@Cacheable Annotation fails. If I remove the Annotation OR the
Configuration in the applicationContext the project works fine again.
Here are some snippets of my configuration:
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ehcache-sprin...@googlegroups.com
You need to inject the interface, not the implementation. @Cacheable works just like any other Spring AOP proxy where a wrapper class is generated that implements all of the interfaces of the target class. Because of this you cannot cast the wrapped class to its actual implementation, you must use the interface that defines the class's APIs to interact with it.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ehcache-sprin...@googlegroups.com
Oh great, didn´t know that. Saved me a lot of time, thank you so much!
Eric Dalquist
unread,
Mar 23, 2011, 7:52:57 AM3/23/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ehcache-sprin...@googlegroups.com
No problem, in general when working with Spring beans should only ever depend on other interfaces. That is how Spring assumes the application will be designed and the only way you really get a loosely coupled application.