1. 程式人生 > >Spring 整合Hibernate 報錯Pointcut is malformed: warning no match for this type name: com.ren.spring.hibe

Spring 整合Hibernate 報錯Pointcut is malformed: warning no match for this type name: com.ren.spring.hibe

    今天Spring整合Hibernate時在Spring的配置檔案中報錯如下:

Pointcut is malformed: warning no match for this type name: com.ren.spring.hibernate.service

    我配置切點的程式碼如下:

<aop:config>
        <aop:pointcut expression="execution(* com.ren.spring.hibernate.service.*(..))" id="poincut"/>
        <aop:advisor
advice-ref="txAdvice" pointcut-ref="poincut"/>
</aop:config>
出錯原因:
expression="execution(* com.ren.spring.hibernate.service.*(..))"表示式寫錯了,應該是:expression="execution(* com.ren.spring.hibernate.service.*.*(..))",第一個*含義是:代表所有型別的返回值,第二個*是代表com.ren.spring.hibernate.service包下的所有類,第三個是類下的所有方法,括號中兩個點表示任意個形參。