在DWR文档中的,有这样的描述:
Aspects & DWR
If you're receiving the dreaded object is not an instance of declaring class error always check these things:
You have an interface and an implementation
You have declared <aop:aspectj-autoproxy proxy-target-class="false" />in your Spring XML
You have decorated your remoted bean with <aop:scoped-proxy />
In fact, AOP proxies work fine with DWR. Just configure Spring accordingly.
下面是一个配置的例子:
<aop:aspectj-autoproxy proxy-target-class="false" />
<bean id="studentServiceJdbc" class="test.StudentServiceJdbc">
<property name="studentDao" ref="studentDao"/>
<dwr:remote javascript="StudentServiceJdbc">
<dwr:include method="insert"/>
<dwr:include method="update"/>
<dwr:include method="remove"/>
<dwr:include method="get"/>
<dwr:include method="getAll"/>
<dwr:include method="getList"/>
<dwr:include method="testTransaction"/>
</dwr:remote>
<aop:scoped-proxy />
</bean>