« Return to Thread: Grails and Spring AOP
Hi,
I am desperately trying to make Spring AOP work in my Grails project. I define
an advice on a service method, which works fine, but as soon as the pointcut
matches and the advice is executed, Grails throws an exception:
"java.lang.IllegalArgumentException: object is not an instance of declaring
class"
I guess this has something to do with Groovy and meta objects? Not sure.
Since I have seen Graeme saying on this mailing list that Spring AOP works just
fine in Grails, I am wondering what I am doing wrong.
Thanks,
Matthias
PS:
Here is my resources.xml, it's just for testing purposes right now (MyAspect is
annotated with @Aspect and defines a public method "foo"):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<aop:config>
<aop:aspect id="theAspect" ref="testAspect">
<aop:pointcut id="exec"
expression="execution(* org.myapp.services.MyService.*(..))" />
<aop:before pointcut-ref="exec" method="foo" />
</aop:aspect>
</aop:config>
<bean id="testAspect" class="org.myapp.MyAspect">
</bean>
</beans>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
« Return to Thread: Grails and Spring AOP
| Free embeddable forum powered by Nabble | Forum Help |