I don't know whether this is by design as I'm new to using Spring AOP, but thought it worth mentioning in case it's a bug; it's certainly occupied a day of my time before I figured out what was going wrong.
I have a class Foo written in Groovy which implements an interface. I'm compiling this to a classfile so am treating it in Spring as a regular bean rather than anything dynamic (i.e. I'm using <bean> not <lang:groovy> to declare it).
The class provides an implementation of a method, and that implementation allows the parameter values to be defaulted.
e.g.
I tried to define an aop:aspect for this interface, but at runtime kept hitting ClassCastException: $Proxy0 errors when another bean tried to call into a reference to Foo handed out by the Spring container.Code:public interface Foo { public void doStuff(String p1, boolean p2) } public class FooImpl implements Foo { public void doStuff(String p1, boolean p2=false) { ... } }
The error disappeared as soon as I removed the default parameter value assignment on the FooImpl.doStuff signature.
Is this expected, or possibly a bug?
Thanks
Alan


Reply With Quote