Spring: Error Cannot convert value of type [$Proxy...] to required type

来源:互联网 发布:淘宝凯文先生鼓谱 编辑:程序博客网 时间:2024/05/22 05:08

来源:http://www.bitsandpix.com/entry/spring-error-cannot-convert-value-of-type-proxy-to-required-type

 

 

In Spring, if you get an error like:

Error Cannot convert value of type [$Proxy...] to required type

It might be because you are using Spring AOP (e.g., @transactional annotations) with “interface-proxy” mode (the Default) rather than “class-proxy” mode. To setup “class-proxy” do the following:

  1. Copy aspectjweaver.jar and aspectjrt.jar to your Web application classpath (you can find these files in the Spring Distribution/lib/aspectj
  2. Add the following in the your app context xml:
    <aop:config proxy-target-class=”true”/>

See also:

  • Spring Forum: Spring Proxy exception

原创粉丝点击