My unit tests start failing after adding declarative caching in applicationContext.xml. This is due to I can no longer retrieve a bean assuming its type, when it's being proxied dynamically.
E.g. to get a service whose get* methods are declared to be cached,
ProductService svc = (ProductService)application.getBean("ProductServic e)
is now failing with,
java.lang.ClassCastException: $Proxy6
Does anyone know how to get the wrapped bean out of a Proxy? I prefer not having to run tests using a "test" version of applicationContext if I can help it.
Thanks
James



