今天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包下的所有类,第三个是类下的所有方法,括号中两个点表示任意个形参。