首先的在最上面加上aop和tx 命名空間 <!-- 配置hibernate事務管理器 --> <bean id="TransManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref bean="sessionFactory"/> </property> </bean> <!-- 配置事務特性 --> <tx:advice id="Transtx" transaction-manager="TransManger"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED"/> <tx:method name="delete*" propagation="REQUIRED"/> <tx:method name="update*" propagation="REQUIRED"/> <tx:method name="find*" propagation="REQUIRED"/> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- 使用aop 注入 --> <aop:config> <aop:pointcut id="pService" expression="execution(* com.qdc.service.*.*.*(..))"/> <aop:advisor advice-ref="Transtx" pointcut-ref="pService"/> </aop:config>