一、应用配置文件增加Seata配置
##############################[seata配置]###################################################
#是否使用分布式事物
seata.enabled=true
seata.application-id=seata-server
seata.tx-service-group=my_test_tx_group
#动态数据源必须为false否则undo_log数据无法清除
seata.enable-auto-data-source-proxy=false
seata.service.vgroup-mapping.my_test_tx_group=default
seata.service.grouplist.default=192.192.192.237:18091
##############################[seata配置]###################################################
ps:如果使用的是dynamic-datasource-spring-boot-starter
数据源seata.enable-auto-data-source-proxy
改为false
,否则为true
二、业务库导入undo_log
表
- 选择适用的建表语句
https://github1s.com/seata/seata/blob/1.4.2/script/client/at/db
三、使用示例
@Override
@