hibernate整合spring當在spring配置文件中加入如下代碼
<!--2.配置事務屬性,需要事務管理器--><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="get*" read-only="true"/><tx:method name="*"/></tx:attributes></tx:advice><!--3.配置事務切點,并把切點和事務屬性關聯起來--><aop:config><aop:pointcut expression="execution(* com.cqupt.sh.service.*.*(..))" id="txPointcut"/><aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/></aop:config>
在運行測試類,就報錯。
?NoClassDefFoundError錯誤一般是少加了什么jar包
?錯誤原因:缺少com.springsource.org.aopalliance-1.0.0.jar
解決方法,在lib路徑下加入缺少對應的jar包問題解決