Test之前准备好的环境
Nacos、Seata的启动
服务的启动

1、下订单->减库存->扣余额->改(订单)状态
2、数据库初始情况
3、正常下单
4、超时异常,没加@GlobalTransactional
AccountServiceImpl添加超时
数据库情况
故障情况:
当库存和账户余额扣减后,订单状态并没有设置为已经完成,没有从0改为1
而且由于feign的重试机制,账户余额可能会再次被多次扣除
5、超时异常,添加@GlobalTransactional
AccountServiceImpl添加超时
OrderServiceImpl @GlobalTransactional
下单后数据库数据没有发生改变
/*** The interface Global transactional.*/@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.METHOD)@Inheritedpublic @interface GlobalTransactional {/*** Global transaction timeoutMills in MILLISECONDS.** @return timeoutMills in MILLISECONDS.*/int timeoutMills() default TransactionInfo.DEFAULT_TIME_OUT;/*** Given name of the global transaction instance.** @return Given name.*/String name() default "";/*** roll back for the Class* @return*/Class<? extends Throwable>[] rollbackFor() default {}; 哪些事务是一定要回滚的/*** roll back for the class name* @return*/String[] rollbackForClassName() default {};/*** not roll back for the Class* @return*/Class<? extends Throwable>[] noRollbackFor() default {};/*** not roll back for the class name* @return*/String[] noRollbackForClassName() default {}; 哪些事务是不需要回滚的}



