声明式事务配置后,切点方法权限未设置。代码如下:
<!-- 配置事务 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<!-- 注入数据源 -->
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="tx" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save"/>
<tx:method name="update"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor advice-ref="tx" pointcut="execution(* *..*.*ServiceImpl.*(..))"/>
</aop:config>
在<tx:attributes></tx:attributes>中添加 Dao 中的方法。