AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
~~~ <!-- 1.配置事务管理器 DataSourceTransactionManager --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 2.添加一个让注解生效的驱动 默认值就是transactionManager <tx:annotation-driven transaction-manager="transactionManager"/> --> <!-- 配置事务属性 --> <tx:advice id="txadvice" transaction-manager="transactionManager"> <!-- 事务属性 --> <tx:attributes> <!-- name属性可以对应具体的方法名称 。然后配置事务具体的属性,传播行为,propagation 以及isolation等。。。 --> <tx:method name="exchangeGoods" propagation="REQUIRES_NEW"/> <tx:method name="find*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="*"/> <!-- *匹配所有方法,exchangeGoods给特定方法添加事务。get find开头的方法添加事务。 --> </tx:attributes> </tx:advice> <!-- 将配置好的事务属性添加到指定方法 。使用springAOP切点表达式进行配置。 --> <aop:config> <aop:pointcut expression="execution(* com.yuan.spring.service.*.*(..))" id="txpointcut"/> <!-- 合并事务跟切点 --> <aop:advisor advice-ref="txadvice" pointcut-ref="txpointcut"/> </aop:config> ~~~