日期:2014-05-18  浏览次数:20689 次

spring AOP中Cglib 代理配置问题,各位指点一下。
本帖最后由 gabiymy 于 2013-02-21 17:27:10 编辑
<bean id="aopHelper" class="com.common.AopHelper" ></bean>
    <aop:config proxy-target-class="true" >
     <!-- 定义一个切面 -->
    <aop:aspect  ref="aopHelper">
      <!-- 定义切入点 -->  
      <aop:pointcut id="myAspect" expression="execution(* *.insert*(..))" />
      <!-- 前置通知 -->  
          <aop:before pointcut-ref="myAspect" method="before"/>
    </aop:aspect>
</aop:config>
意思就是所有的insert开头的方法切到class="com.common.AopHelper"这个类里面。这个类里面就写了一个方法
public void before(){
        System.out.println("我已经开始要记录操作行为了。");
    }

系统报错
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClientTemplate' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient': Post-processing of the FactoryBean's object failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.ibatis.sqlmap.engine.impl.SqlMapClientImpl]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient': Post-processing of the FactoryBean's object failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.ibatis.sqlmap.engine.impl.SqlMapClientImpl]: Common causes of this problem include using a final class or a non-visible class; nested exception is&n