diff --git a/docs/zh/core/tx.md b/docs/zh/core/tx.md
index 084370e0..fb6eb4ea 100644
--- a/docs/zh/core/tx.md
+++ b/docs/zh/core/tx.md
@@ -224,9 +224,13 @@ public void purchase(String userId, String commodityCode, int orderCount) {
> 的官方示例快速开始:https://seata.io/zh-cn/docs/user/quickstart.html
### 注意事项
-
-在使用 Seata 分布式事务时,请注意添加 Seata 的相关 Maven 依赖,例如:
-
+1.使用`seata-spring-boot-starter`的时候请关闭自动代理
+```yaml
+seata:
+ enable-auto-data-source-proxy: false
+```
+2.使用`seata-all`请不要使用`@EnableAutoDataSourceProxy`
+3.如果是boot项目可以引入相关Maven依赖,例如:
```xml
io.seata
@@ -234,3 +238,12 @@ public void purchase(String userId, String commodityCode, int orderCount) {
1.7.0
```
+### 事例
+请到mybatis-flex-test模块下面:
+```xml
+mybatis-flex-spring-boot-seata:flex多数据源与seata的结合
+```
+```xml
+mybatis-flex-spring-boot-seata-demo:官方demo与flex结合
+```
+
diff --git a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MultiDataSourceAutoConfiguration.java b/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MultiDataSourceAutoConfiguration.java
index f8b155ea..8576ddd3 100644
--- a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MultiDataSourceAutoConfiguration.java
+++ b/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MultiDataSourceAutoConfiguration.java
@@ -19,6 +19,7 @@ import com.mybatisflex.core.datasource.DataSourceBuilder;
import com.mybatisflex.core.datasource.DataSourceDecipher;
import com.mybatisflex.core.datasource.DataSourceManager;
import com.mybatisflex.core.datasource.FlexDataSource;
+import com.mybatisflex.spring.SeataMode;
import com.mybatisflex.spring.boot.MybatisFlexProperties.SeataConfig;
import com.mybatisflex.spring.datasource.DataSourceAdvice;
import io.seata.rm.datasource.DataSourceProxy;
diff --git a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MybatisFlexProperties.java b/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MybatisFlexProperties.java
index d5bf56fb..b7cbd98c 100644
--- a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MybatisFlexProperties.java
+++ b/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/MybatisFlexProperties.java
@@ -17,6 +17,7 @@ package com.mybatisflex.spring.boot;
import com.mybatisflex.core.FlexConsts;
import com.mybatisflex.core.FlexGlobalConfig;
+import com.mybatisflex.spring.SeataMode;
import org.apache.ibatis.io.VFS;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.mapping.ResultSetType;
diff --git a/mybatis-flex-spring/pom.xml b/mybatis-flex-spring/pom.xml
index 7facc147..b786dc4d 100644
--- a/mybatis-flex-spring/pom.xml
+++ b/mybatis-flex-spring/pom.xml
@@ -40,6 +40,12 @@
spring-jdbc
+
+ io.seata
+ seata-spring-boot-starter
+ 1.7.0
+
+
diff --git a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java
index f15d2e68..c29d74b6 100644
--- a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java
+++ b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSpringTransaction.java
@@ -88,6 +88,6 @@ public class FlexSpringTransaction implements Transaction {
@Override
public Integer getTimeout() throws SQLException {
- return getConnection().getNetworkTimeout();
+ return null;
}
}
diff --git a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSqlSessionFactoryBean.java b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSqlSessionFactoryBean.java
index 9eea1ccc..b78352c3 100644
--- a/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSqlSessionFactoryBean.java
+++ b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/FlexSqlSessionFactoryBean.java
@@ -19,6 +19,8 @@ import com.mybatisflex.core.FlexConsts;
import com.mybatisflex.core.datasource.FlexDataSource;
import com.mybatisflex.core.mybatis.FlexConfiguration;
import com.mybatisflex.core.mybatis.FlexSqlSessionFactoryBuilder;
+import io.seata.rm.datasource.DataSourceProxy;
+import io.seata.rm.datasource.xa.DataSourceProxyXA;
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
import org.apache.ibatis.cache.Cache;
diff --git a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/SeataMode.java b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/SeataMode.java
similarity index 95%
rename from mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/SeataMode.java
rename to mybatis-flex-spring/src/main/java/com/mybatisflex/spring/SeataMode.java
index b02af607..cbabe97b 100644
--- a/mybatis-flex-spring-boot-starter/src/main/java/com/mybatisflex/spring/boot/SeataMode.java
+++ b/mybatis-flex-spring/src/main/java/com/mybatisflex/spring/SeataMode.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.mybatisflex.spring.boot;
+package com.mybatisflex.spring;
/**
* @author life
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.jar b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 00000000..bf82ff01
Binary files /dev/null and b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.properties b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..ca5ab4ba
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw
new file mode 100755
index 00000000..8a8fb228
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw
@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw.cmd b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw.cmd
new file mode 100644
index 00000000..1d8ab018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/pom.xml
new file mode 100644
index 00000000..b3f69618
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+
+
+ mybatisflex.seata.acount
+ account-service
+ 0.0.1-SNAPSHOT
+ account-service
+ account-service
+
+ 1.8
+
+
+
+
+ mybatisflex.test
+ common-service
+ 0.0.1-SNAPSHOT
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector.version}
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid-spring-boot-starter.version}
+
+
+ com.mybatis-flex
+ mybatis-flex-spring-boot-starter
+ ${mybatis-flex.version}
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/AccountServiceApplication.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/AccountServiceApplication.java
new file mode 100644
index 00000000..93834e5c
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/AccountServiceApplication.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.acount.accountservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = "mybatisflex.test")
+public class AccountServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(AccountServiceApplication.class, args);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/config/RestTemplateConfig.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/config/RestTemplateConfig.java
new file mode 100644
index 00000000..c5605f4c
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/config/RestTemplateConfig.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.acount.accountservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ public RestTemplate restTemplate() {
+ RestTemplate restTemplate = new RestTemplate();
+ return restTemplate;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/controller/AccountController.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/controller/AccountController.java
new file mode 100644
index 00000000..4b7f2250
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/controller/AccountController.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.acount.accountservice.controller;
+
+import io.seata.core.context.RootContext;
+import java.math.BigDecimal;
+import mybatisflex.test.acount.accountservice.service.AccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class AccountController {
+
+ @Autowired
+ AccountService accountService;
+
+ @GetMapping
+ public void debit(@RequestParam String userId, @RequestParam BigDecimal orderMoney) {
+ System.out.println("account XID " + RootContext.getXID());
+ accountService.debit(userId, orderMoney);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/Account.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/Account.java
new file mode 100644
index 00000000..9f36d497
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/Account.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.acount.accountservice.persistence;
+
+import java.math.BigDecimal;
+
+public class Account {
+ private Integer id;
+
+ private String userId;
+
+ private BigDecimal money;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public BigDecimal getMoney() {
+ return money;
+ }
+
+ public void setMoney(BigDecimal money) {
+ this.money = money;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/AccountMapper.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/AccountMapper.java
new file mode 100644
index 00000000..282c10f5
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/persistence/AccountMapper.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.acount.accountservice.persistence;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface AccountMapper {
+
+ Account selectByUserId(@Param("userId") String userId);
+
+ int updateById(Account record);
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/service/AccountService.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/service/AccountService.java
new file mode 100644
index 00000000..14fbfa26
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/java/mybatisflex/test/acount/accountservice/service/AccountService.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.acount.accountservice.service;
+
+import java.math.BigDecimal;
+import mybatisflex.test.acount.accountservice.persistence.Account;
+import mybatisflex.test.acount.accountservice.persistence.AccountMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AccountService {
+
+ private static final String ERROR_USER_ID = "1002";
+
+ @Autowired
+ private AccountMapper accountMapper;
+
+ public void debit(String userId, BigDecimal num) {
+ Account account = accountMapper.selectByUserId(userId);
+ account.setMoney(account.getMoney().subtract(num));
+ accountMapper.updateById(account);
+
+ if (ERROR_USER_ID.equals(userId)) {
+ throw new RuntimeException("account branch exception");
+ }
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/application.yml
new file mode 100755
index 00000000..d6583cd6
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/application.yml
@@ -0,0 +1,116 @@
+server:
+ port: 8083
+spring:
+ main:
+ allow-circular-references: true
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://127.0.0.1:3306/db_account?useSSL=false&serverTimezone=UTC
+ username: root
+ password: 131496
+seata:
+ enabled: true
+ application-id: account-service
+ tx-service-group: my_test_tx_group
+ client:
+ rm:
+ async-commit-buffer-limit: 1000
+ report-retry-count: 5
+ table-meta-check-enable: false
+ report-success-enable: false
+ lock:
+ retry-interval: 10
+ retry-times: 30
+ retry-policy-branch-rollback-on-conflict: true
+ tm:
+ commit-retry-count: 5
+ rollback-retry-count: 5
+ undo:
+ data-validation: true
+ log-serialization: jackson
+ log-table: undo_log
+ log:
+ exceptionRate: 100
+ service:
+ vgroup-mapping:
+ my_test_tx_group: default
+ grouplist:
+ default: 127.0.0.1:8091
+ #enable-degrade: false
+ #disable-global-transaction: false
+ transport:
+ shutdown:
+ wait: 3
+ thread-factory:
+ boss-thread-prefix: NettyBoss
+ worker-thread-prefix: NettyServerNIOWorker
+ server-executor-thread-prefix: NettyServerBizHandler
+ share-boss-worker: false
+ client-selector-thread-prefix: NettyClientSelector
+ client-selector-thread-size: 1
+ client-worker-thread-prefix: NettyClientWorkerThread
+ worker-thread-size: default
+ boss-thread-size: 1
+ type: TCP
+ server: NIO
+ heartbeat: true
+ serialization: seata
+ compressor: none
+ enable-client-batch-send-request: true
+ config:
+ type: file
+ consul:
+ server-addr: 127.0.0.1:8500
+ apollo:
+ apollo-meta: http://192.168.1.204:8801
+ app-id: seata-server
+ namespace: application
+ etcd3:
+ server-addr: http://localhost:2379
+ nacos:
+ namespace:
+ serverAddr: localhost
+ group: SEATA_GROUP
+ zk:
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
+ registry:
+ type: file
+ consul:
+ cluster: default
+ server-addr: 127.0.0.1:8500
+ etcd3:
+ cluster: default
+ serverAddr: http://localhost:2379
+ eureka:
+ application: default
+ weight: 1
+ service-url: http://localhost:8761/eureka
+ nacos:
+ cluster: default
+ server-addr: localhost
+ namespace:
+ redis:
+ server-addr: localhost:6379
+ db: 0
+ password:
+ cluster: default
+ timeout: 0
+ sofa:
+ server-addr: 127.0.0.1:9603
+ application: default
+ region: DEFAULT_ZONE
+ datacenter: DefaultDataCenter
+ cluster: default
+ group: SEATA_GROUP
+ addressWaitTime: 3000
+ zk:
+ cluster: default
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/mapper/AccountMapper.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/mapper/AccountMapper.xml
new file mode 100644
index 00000000..b5f265b5
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/main/resources/mapper/AccountMapper.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ update account_tbl
+ set money = #{money,jdbcType=DECIMAL}
+ where id = #{id}
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/test/java/mybatisflex/test/acount/accountservice/AccountServiceApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/test/java/mybatisflex/test/acount/accountservice/AccountServiceApplicationTests.java
new file mode 100644
index 00000000..db7e42ad
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/account-service/src/test/java/mybatisflex/test/acount/accountservice/AccountServiceApplicationTests.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.acount.accountservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class AccountServiceApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.jar b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 00000000..bf82ff01
Binary files /dev/null and b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.properties b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..ca5ab4ba
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw
new file mode 100755
index 00000000..8a8fb228
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw
@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw.cmd b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw.cmd
new file mode 100644
index 00000000..1d8ab018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/pom.xml
new file mode 100644
index 00000000..8084dbb1
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/pom.xml
@@ -0,0 +1,37 @@
+
+
+ 4.0.0
+
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+
+
+ mybatisflex.test
+ business-service
+ 0.0.1-SNAPSHOT
+ business-service
+ business-service
+
+ 1.8
+
+
+
+ mybatisflex.test
+ common-service
+ 0.0.1-SNAPSHOT
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/BusinessServiceApplication.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/BusinessServiceApplication.java
new file mode 100644
index 00000000..e7ac5b91
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/BusinessServiceApplication.java
@@ -0,0 +1,14 @@
+package mybatisflex.test.businessservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(scanBasePackages = "mybatisflex.test")
+public class BusinessServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(BusinessServiceApplication.class, args);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/OrderClient.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/OrderClient.java
new file mode 100644
index 00000000..d02e0c55
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/OrderClient.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.businessservice.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class OrderClient {
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ public void create(String userId, String commodityCode, int orderCount) {
+ String url = "http://127.0.0.1:8082/api/order/debit?userId=" + userId + "&commodityCode=" + commodityCode
+ + "&count=" + orderCount;
+ try {
+ restTemplate.getForEntity(url, Void.class);
+ } catch (Exception e) {
+ throw new RuntimeException(String.format("create url %s ,error:", url));
+ }
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/StockClient.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/StockClient.java
new file mode 100644
index 00000000..00897bec
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/client/StockClient.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.businessservice.client;
+
+import io.seata.core.context.RootContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class StockClient {
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ public void deduct(String commodityCode, int orderCount) {
+ System.out.println("business to stock " + RootContext.getXID());
+ String url = "http://127.0.0.1:8081/api/stock/deduct?commodityCode=" + commodityCode + "&count=" + orderCount;
+ try {
+ restTemplate.getForEntity(url, Void.class);
+ } catch (Exception e) {
+ throw new RuntimeException(String.format("deduct url %s ,error:",url),e);
+ }
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/config/RestTemplateConfig.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/config/RestTemplateConfig.java
new file mode 100644
index 00000000..ef16cb29
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/config/RestTemplateConfig.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.businessservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ public RestTemplate restTemplate() {
+ RestTemplate restTemplate = new RestTemplate();
+ return restTemplate;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/controller/BusinessController.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/controller/BusinessController.java
new file mode 100644
index 00000000..5c66fb0b
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/controller/BusinessController.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.businessservice.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import mybatisflex.test.businessservice.service.BusinessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("/api/business")
+@RestController
+public class BusinessController {
+
+ @Autowired
+ private BusinessService businessService;
+
+ /**
+ * 购买下单,模拟全局事务提交
+ *
+ * @return
+ */
+ @RequestMapping("/purchase/commit")
+ public Boolean purchaseCommit(HttpServletRequest request) {
+ businessService.purchase("1001", "2001", 1);
+ return true;
+ }
+
+ /**
+ * 购买下单,模拟全局事务回滚
+ *
+ * @return
+ */
+ @RequestMapping("/purchase/rollback")
+ public Boolean purchaseRollback() {
+ try {
+ businessService.purchase("1002", "2001", 1);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/service/BusinessService.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/service/BusinessService.java
new file mode 100644
index 00000000..6a74f0e8
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/java/mybatisflex/test/businessservice/service/BusinessService.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.businessservice.service;
+
+import io.seata.core.context.RootContext;
+import io.seata.spring.annotation.GlobalTransactional;
+import mybatisflex.test.businessservice.client.OrderClient;
+import mybatisflex.test.businessservice.client.StockClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class BusinessService {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(BusinessService.class);
+
+ @Autowired
+ private StockClient stockClient;
+ @Autowired
+ private OrderClient orderClient;
+
+ /**
+ * 减库存,下订单
+ *
+ * @param userId
+ * @param commodityCode
+ * @param orderCount
+ */
+ @GlobalTransactional
+ public void purchase(String userId, String commodityCode, int orderCount) {
+ LOGGER.info("purchase begin ... xid: " + RootContext.getXID());
+ stockClient.deduct(commodityCode, orderCount);
+ orderClient.create(userId, commodityCode, orderCount);
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/resources/application.yml
new file mode 100755
index 00000000..173f96c5
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/main/resources/application.yml
@@ -0,0 +1,113 @@
+server:
+ port: 8084
+spring:
+ main:
+ allow-circular-references: true
+seata:
+ enabled: true
+ application-id: business-service
+ tx-service-group: my_test_tx_group
+ enable-auto-data-source-proxy: false
+ #use-jdk-proxy: false
+ client:
+ rm:
+ async-commit-buffer-limit: 1000
+ report-retry-count: 5
+ table-meta-check-enable: false
+ report-success-enable: false
+ lock:
+ retry-interval: 10
+ retry-times: 30
+ retry-policy-branch-rollback-on-conflict: true
+ tm:
+ commit-retry-count: 5
+ rollback-retry-count: 5
+ undo:
+ data-validation: true
+ log-serialization: jackson
+ log-table: undo_log
+ log:
+ exceptionRate: 100
+ service:
+ vgroup-mapping:
+ my_test_tx_group: default
+ grouplist:
+ default: 127.0.0.1:8091
+ #enable-degrade: false
+ #disable-global-transaction: false
+ transport:
+ shutdown:
+ wait: 3
+ thread-factory:
+ boss-thread-prefix: NettyBoss
+ worker-thread-prefix: NettyServerNIOWorker
+ server-executor-thread-prefix: NettyServerBizHandler
+ share-boss-worker: false
+ client-selector-thread-prefix: NettyClientSelector
+ client-selector-thread-size: 1
+ client-worker-thread-prefix: NettyClientWorkerThread
+ worker-thread-size: default
+ boss-thread-size: 1
+ type: TCP
+ server: NIO
+ heartbeat: true
+ serialization: seata
+ compressor: none
+ enable-client-batch-send-request: true
+ config:
+ type: file
+ consul:
+ server-addr: 127.0.0.1:8500
+ apollo:
+ apollo-meta: http://192.168.1.204:8801
+ app-id: seata-server
+ namespace: application
+ etcd3:
+ server-addr: http://localhost:2379
+ nacos:
+ namespace:
+ serverAddr: localhost
+ group: SEATA_GROUP
+ zk:
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
+ registry:
+ type: file
+ consul:
+ cluster: default
+ server-addr: 127.0.0.1:8500
+ etcd3:
+ cluster: default
+ serverAddr: http://localhost:2379
+ eureka:
+ application: default
+ weight: 1
+ service-url: http://localhost:8761/eureka
+ nacos:
+ cluster: default
+ server-addr: localhost
+ namespace:
+ redis:
+ server-addr: localhost:6379
+ db: 0
+ password:
+ cluster: default
+ timeout: 0
+ sofa:
+ server-addr: 127.0.0.1:9603
+ application: default
+ region: DEFAULT_ZONE
+ datacenter: DefaultDataCenter
+ cluster: default
+ group: SEATA_GROUP
+ addressWaitTime: 3000
+ zk:
+ cluster: default
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/test/java/mybatisflex/test/businessservice/BusinessServiceApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/test/java/mybatisflex/test/businessservice/BusinessServiceApplicationTests.java
new file mode 100644
index 00000000..d555724b
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/business-service/src/test/java/mybatisflex/test/businessservice/BusinessServiceApplicationTests.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.businessservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class BusinessServiceApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.jar b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 00000000..bf82ff01
Binary files /dev/null and b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.properties b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..ca5ab4ba
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw
new file mode 100755
index 00000000..8a8fb228
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw
@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw.cmd b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw.cmd
new file mode 100644
index 00000000..1d8ab018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/pom.xml
new file mode 100644
index 00000000..512a7854
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/pom.xml
@@ -0,0 +1,72 @@
+
+
+ 4.0.0
+
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+
+
+ mybatisflex.test
+ common-service
+ 0.0.1-SNAPSHOT
+ common-service
+ common-service
+
+ 1.8
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ ${springboot.version}
+
+
+
+
+ io.seata
+ seata-spring-boot-starter
+ ${seata.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ ${springboot.version}
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/config/SeataRestTemplateAutoConfiguration.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/config/SeataRestTemplateAutoConfiguration.java
new file mode 100644
index 00000000..5749ff4c
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/config/SeataRestTemplateAutoConfiguration.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.commonservice.config;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import mybatisflex.test.commonservice.interceptor.SeataRestTemplateInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class SeataRestTemplateAutoConfiguration {
+ @Autowired(required = false)
+ private Collection restTemplates;
+ @Autowired
+ private SeataRestTemplateInterceptor seataRestTemplateInterceptor;
+
+ public SeataRestTemplateAutoConfiguration() {
+ }
+
+ @Bean
+ public SeataRestTemplateInterceptor seataRestTemplateInterceptor() {
+ return new SeataRestTemplateInterceptor();
+ }
+
+ @PostConstruct
+ public void init() {
+ if (this.restTemplates != null) {
+ Iterator var1 = this.restTemplates.iterator();
+
+ while (var1.hasNext()) {
+ RestTemplate restTemplate = (RestTemplate)var1.next();
+ List interceptors = new ArrayList(restTemplate.getInterceptors());
+ interceptors.add(this.seataRestTemplateInterceptor);
+ restTemplate.setInterceptors(interceptors);
+ }
+ }
+
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/filter/SeataFilter.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/filter/SeataFilter.java
new file mode 100644
index 00000000..598d7161
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/filter/SeataFilter.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.commonservice.filter;
+
+import io.seata.core.context.RootContext;
+import java.io.IOException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SeataFilter implements Filter {
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+ }
+
+ @Override
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+ throws IOException, ServletException {
+ HttpServletRequest req = (HttpServletRequest)servletRequest;
+ String xid = req.getHeader(RootContext.KEY_XID.toLowerCase());
+ boolean isBind = false;
+ if (StringUtils.isNotBlank(xid)) {
+ RootContext.bind(xid);
+ isBind = true;
+ }
+ try {
+ filterChain.doFilter(servletRequest, servletResponse);
+ } finally {
+ if (isBind) {
+ RootContext.unbind();
+ }
+ }
+ }
+
+ @Override
+ public void destroy() {
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/interceptor/SeataRestTemplateInterceptor.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/interceptor/SeataRestTemplateInterceptor.java
new file mode 100644
index 00000000..6b5062d4
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/main/java/mybatisflex/test/commonservice/interceptor/SeataRestTemplateInterceptor.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.commonservice.interceptor;
+
+import io.seata.core.context.RootContext;
+import java.io.IOException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestExecution;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.http.client.support.HttpRequestWrapper;
+import org.springframework.stereotype.Component;
+
+
+public class SeataRestTemplateInterceptor implements ClientHttpRequestInterceptor {
+ public SeataRestTemplateInterceptor() {
+ }
+
+ public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes,
+ ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
+ HttpRequestWrapper requestWrapper = new HttpRequestWrapper(httpRequest);
+ String xid = RootContext.getXID();
+ if (StringUtils.isNotEmpty(xid)) {
+ requestWrapper.getHeaders().add(RootContext.KEY_XID, xid);
+ }
+
+ return clientHttpRequestExecution.execute(requestWrapper, bytes);
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/test/java/mybatisflex/test/commonservice/CommonServiceApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/test/java/mybatisflex/test/commonservice/CommonServiceApplicationTests.java
new file mode 100644
index 00000000..e877b620
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/common-service/src/test/java/mybatisflex/test/commonservice/CommonServiceApplicationTests.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.commonservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class CommonServiceApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.jar b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 00000000..bf82ff01
Binary files /dev/null and b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.properties b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..ca5ab4ba
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw
new file mode 100755
index 00000000..8a8fb228
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw
@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw.cmd b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw.cmd
new file mode 100644
index 00000000..1d8ab018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/pom.xml
new file mode 100644
index 00000000..3ffa02d7
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+
+
+ mybatisflex.test
+ order-service
+ 0.0.1-SNAPSHOT
+ order-service
+ order-service
+
+ 1.8
+
+
+
+ mybatisflex.test
+ common-service
+ 0.0.1-SNAPSHOT
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector.version}
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid-spring-boot-starter.version}
+
+
+ com.mybatis-flex
+ mybatis-flex-spring-boot-starter
+ ${mybatis-flex.version}
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/OrderServiceApplication.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/OrderServiceApplication.java
new file mode 100644
index 00000000..fdd50c88
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/OrderServiceApplication.java
@@ -0,0 +1,14 @@
+package mybatisflex.test.orderservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(scanBasePackages = "mybatisflex.test")
+public class OrderServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(OrderServiceApplication.class, args);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/client/AccountClient.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/client/AccountClient.java
new file mode 100644
index 00000000..e3d5167b
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/client/AccountClient.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.client;
+
+import java.math.BigDecimal;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class AccountClient {
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ public void debit(String userId, BigDecimal orderMoney) {
+ String url = "http://127.0.0.1:8083?userId=" + userId + "&orderMoney=" + orderMoney;
+ try {
+ restTemplate.getForEntity(url, Void.class);
+ } catch (Exception e) {
+ throw new RuntimeException(String.format("debit url %s ,error:",url),e);
+ }
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/config/RestTemplateConfig.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/config/RestTemplateConfig.java
new file mode 100644
index 00000000..62e68996
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/config/RestTemplateConfig.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ public RestTemplate restTemplate() {
+ RestTemplate restTemplate = new RestTemplate();
+ return restTemplate;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/controller/OrderController.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/controller/OrderController.java
new file mode 100644
index 00000000..948e3659
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/controller/OrderController.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.controller;
+
+import io.seata.core.context.RootContext;
+import mybatisflex.test.orderservice.service.OrderService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("/api/order")
+@RestController
+public class OrderController {
+
+ @Autowired
+ OrderService orderService;
+
+ @GetMapping(value = "/debit")
+ public void debit(@RequestParam String userId, @RequestParam String commodityCode, @RequestParam Integer count) {
+ System.out.println("order XID " + RootContext.getXID());
+ orderService.create(userId, commodityCode, count);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/Order.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/Order.java
new file mode 100644
index 00000000..4e800413
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/Order.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.persistence;
+
+import java.math.BigDecimal;
+
+public class Order {
+ private Integer id;
+
+ private String userId;
+
+ private String commodityCode;
+
+ private Integer count;
+
+ private BigDecimal money;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getCommodityCode() {
+ return commodityCode;
+ }
+
+ public void setCommodityCode(String commodityCode) {
+ this.commodityCode = commodityCode;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public BigDecimal getMoney() {
+ return money;
+ }
+
+ public void setMoney(BigDecimal money) {
+ this.money = money;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/OrderMapper.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/OrderMapper.java
new file mode 100644
index 00000000..e6259c41
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/persistence/OrderMapper.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.persistence;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface OrderMapper {
+
+ int insert(Order record);
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/service/OrderService.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/service/OrderService.java
new file mode 100644
index 00000000..5f774b8b
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/java/mybatisflex/test/orderservice/service/OrderService.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.orderservice.service;
+
+
+import java.math.BigDecimal;
+import mybatisflex.test.orderservice.client.AccountClient;
+import mybatisflex.test.orderservice.persistence.Order;
+import mybatisflex.test.orderservice.persistence.OrderMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class OrderService {
+
+ @Autowired
+ private AccountClient accountClient;
+ @Autowired
+ private OrderMapper orderMapper;
+
+ public void create(String userId, String commodityCode, Integer count) {
+ BigDecimal orderMoney = new BigDecimal(count).multiply(new BigDecimal(5));
+ Order order = new Order();
+ order.setUserId(userId);
+ order.setCommodityCode(commodityCode);
+ order.setCount(count);
+ order.setMoney(orderMoney);
+
+ orderMapper.insert(order);
+
+ accountClient.debit(userId, orderMoney);
+
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/application.yml
new file mode 100755
index 00000000..b9adc104
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/application.yml
@@ -0,0 +1,118 @@
+server:
+ port: 8082
+spring:
+ main:
+ allow-circular-references: true
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://127.0.0.1:3306/db_order?useSSL=false&serverTimezone=UTC
+ username: root
+ password: 131496
+seata:
+ enabled: true
+ application-id: order-service
+ tx-service-group: my_test_tx_group
+# enable-auto-data-source-proxy: false
+ #use-jdk-proxy: false
+ client:
+ rm:
+ async-commit-buffer-limit: 1000
+ report-retry-count: 5
+ table-meta-check-enable: false
+ report-success-enable: false
+ lock:
+ retry-interval: 10
+ retry-times: 30
+ retry-policy-branch-rollback-on-conflict: true
+ tm:
+ commit-retry-count: 5
+ rollback-retry-count: 5
+ undo:
+ data-validation: true
+ log-serialization: jackson
+ log-table: undo_log
+ log:
+ exceptionRate: 100
+ service:
+ vgroup-mapping:
+ my_test_tx_group: default
+ grouplist:
+ default: 127.0.0.1:8091
+ #enable-degrade: false
+ #disable-global-transaction: false
+ transport:
+ shutdown:
+ wait: 3
+ thread-factory:
+ boss-thread-prefix: NettyBoss
+ worker-thread-prefix: NettyServerNIOWorker
+ server-executor-thread-prefix: NettyServerBizHandler
+ share-boss-worker: false
+ client-selector-thread-prefix: NettyClientSelector
+ client-selector-thread-size: 1
+ client-worker-thread-prefix: NettyClientWorkerThread
+ worker-thread-size: default
+ boss-thread-size: 1
+ type: TCP
+ server: NIO
+ heartbeat: true
+ serialization: seata
+ compressor: none
+ enable-client-batch-send-request: true
+ config:
+ type: file
+ consul:
+ server-addr: 127.0.0.1:8500
+ apollo:
+ apollo-meta: http://192.168.1.204:8801
+ app-id: seata-server
+ namespace: application
+ etcd3:
+ server-addr: http://localhost:2379
+ nacos:
+ namespace:
+ serverAddr: localhost
+ group: SEATA_GROUP
+ zk:
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
+ registry:
+ type: file
+ consul:
+ cluster: default
+ server-addr: 127.0.0.1:8500
+ etcd3:
+ cluster: default
+ serverAddr: http://localhost:2379
+ eureka:
+ application: default
+ weight: 1
+ service-url: http://localhost:8761/eureka
+ nacos:
+ cluster: default
+ server-addr: localhost
+ namespace:
+ redis:
+ server-addr: localhost:6379
+ db: 0
+ password:
+ cluster: default
+ timeout: 0
+ sofa:
+ server-addr: 127.0.0.1:9603
+ application: default
+ region: DEFAULT_ZONE
+ datacenter: DefaultDataCenter
+ cluster: default
+ group: SEATA_GROUP
+ addressWaitTime: 3000
+ zk:
+ cluster: default
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/mapper/OrderMapper.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/mapper/OrderMapper.xml
new file mode 100644
index 00000000..b052cac6
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/main/resources/mapper/OrderMapper.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into order_tbl (user_id, commodity_code, count, money)
+ values (#{userId,jdbcType=VARCHAR}, #{commodityCode,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER},
+ #{money,jdbcType=DECIMAL})
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/test/java/mybatisflex/test/orderservice/OrderServiceApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/test/java/mybatisflex/test/orderservice/OrderServiceApplicationTests.java
new file mode 100644
index 00000000..a639941f
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/order-service/src/test/java/mybatisflex/test/orderservice/OrderServiceApplicationTests.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.orderservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class OrderServiceApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/pom.xml
new file mode 100644
index 00000000..6b217c74
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/pom.xml
@@ -0,0 +1,80 @@
+
+
+ 4.0.0
+
+ mybatis-flex-test
+ com.mybatis-flex
+ 1.5.6
+
+ pom
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+ mybatis-flex-spring-boot-seata-demo
+ mybatis-flex-spring-boot-seata-demo
+
+ 1.8
+ 2.7.11
+ 1.1.10
+ 5.1.44
+ 1.4.2
+
+
+ account-service
+ business-service
+ common-service
+ order-service
+ stock-service
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot
+ ${springboot.version}
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+ ${springboot.version}
+
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector.version}
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid-spring-boot-starter.version}
+
+
+ io.seata
+ seata-spring-boot-starter
+ ${seata.version}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/sql/all_in_one.sql b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/sql/all_in_one.sql
new file mode 100644
index 00000000..e4a1f88e
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/sql/all_in_one.sql
@@ -0,0 +1,97 @@
+# Account
+DROP SCHEMA IF EXISTS db_account;
+CREATE SCHEMA db_account;
+USE db_account;
+
+CREATE TABLE `account_tbl`
+(
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `user_id` VARCHAR(255) DEFAULT NULL,
+ `money` INT(11) DEFAULT 0,
+ PRIMARY KEY (`id`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8;
+
+INSERT INTO account_tbl (id, user_id, money)
+VALUES (1, '1001', 10000);
+INSERT INTO account_tbl (id, user_id, money)
+VALUES (2, '1002', 10000);
+
+CREATE TABLE `undo_log`
+(
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `branch_id` bigint(20) NOT NULL,
+ `xid` varchar(100) NOT NULL,
+ `context` varchar(128) NOT NULL,
+ `rollback_info` longblob NOT NULL,
+ `log_status` int(11) NOT NULL,
+ `log_created` datetime NOT NULL,
+ `log_modified` datetime NOT NULL,
+ `ext` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+# Order
+DROP SCHEMA IF EXISTS db_order;
+CREATE SCHEMA db_order;
+USE db_order;
+
+CREATE TABLE `order_tbl`
+(
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `user_id` VARCHAR(255) DEFAULT NULL,
+ `commodity_code` VARCHAR(255) DEFAULT NULL,
+ `count` INT(11) DEFAULT '0',
+ `money` INT(11) DEFAULT '0',
+ PRIMARY KEY (`id`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8;
+
+CREATE TABLE `undo_log`
+(
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `branch_id` bigint(20) NOT NULL,
+ `xid` varchar(100) NOT NULL,
+ `context` varchar(128) NOT NULL,
+ `rollback_info` longblob NOT NULL,
+ `log_status` int(11) NOT NULL,
+ `log_created` datetime NOT NULL,
+ `log_modified` datetime NOT NULL,
+ `ext` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+# stock
+DROP SCHEMA IF EXISTS db_stock;
+CREATE SCHEMA db_stock;
+USE db_stock;
+
+CREATE TABLE `stock_tbl`
+(
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `commodity_code` VARCHAR(255) DEFAULT NULL,
+ `count` INT(11) DEFAULT '0',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `commodity_code` (`commodity_code`)
+) ENGINE = InnoDB
+ DEFAULT CHARSET = utf8;
+
+
+INSERT INTO stock_tbl (id, commodity_code, count)
+VALUES (1, '2001', 1000);
+
+CREATE TABLE `undo_log`
+(
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `branch_id` bigint(20) NOT NULL,
+ `xid` varchar(100) NOT NULL,
+ `context` varchar(128) NOT NULL,
+ `rollback_info` longblob NOT NULL,
+ `log_status` int(11) NOT NULL,
+ `log_created` datetime NOT NULL,
+ `log_modified` datetime NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.jar b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 00000000..bf82ff01
Binary files /dev/null and b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.properties b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 00000000..ca5ab4ba
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw
new file mode 100755
index 00000000..8a8fb228
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw
@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`\\unset -f command; \\command -v java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ $MAVEN_DEBUG_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" \
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw.cmd b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw.cmd
new file mode 100644
index 00000000..1d8ab018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/mvnw.cmd
@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/pom.xml
new file mode 100644
index 00000000..b9e4c3e0
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/pom.xml
@@ -0,0 +1,52 @@
+
+
+ 4.0.0
+
+ mybatisflex-test
+ mybatis-flex-spring-boot-seata-demo
+ 0.0.1-SNAPSHOT
+
+
+ mybatisflex.test
+ stock-service
+ 0.0.1-SNAPSHOT
+ stock-service
+ stock-service
+
+ 1.8
+
+
+
+ mybatisflex.test
+ common-service
+ 0.0.1-SNAPSHOT
+
+
+ mysql
+ mysql-connector-java
+ ${mysql-connector.version}
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ ${druid-spring-boot-starter.version}
+
+
+ com.mybatis-flex
+ mybatis-flex-spring-boot-starter
+ ${mybatis-flex.version}
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/StockServiceApplication.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/StockServiceApplication.java
new file mode 100644
index 00000000..2c2e1011
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/StockServiceApplication.java
@@ -0,0 +1,14 @@
+package mybatisflex.test.stockservice;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+@SpringBootApplication(scanBasePackages = "mybatisflex.test")
+public class StockServiceApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(StockServiceApplication.class, args);
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/config/RestTemplateConfig.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/config/RestTemplateConfig.java
new file mode 100644
index 00000000..6d204018
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/config/RestTemplateConfig.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.stockservice.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+ @Bean
+ public RestTemplate restTemplate() {
+ RestTemplate restTemplate = new RestTemplate();
+ return restTemplate;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/controller/StockController.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/controller/StockController.java
new file mode 100644
index 00000000..2d394839
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/controller/StockController.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.stockservice.controller;
+
+import io.seata.core.context.RootContext;
+import java.sql.SQLException;
+import mybatisflex.test.stockservice.persistence.Stock;
+import mybatisflex.test.stockservice.service.StockService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping("/api/stock")
+@RestController
+public class StockController {
+
+ @Autowired
+ StockService stockService;
+
+ @GetMapping(value = "/deduct")
+ public void deduct(@RequestParam String commodityCode, @RequestParam Integer count) throws SQLException {
+ System.out.println("stock XID " + RootContext.getXID());
+ stockService.deduct(commodityCode, count);
+ }
+
+ @GetMapping(value = "/get/{id}")
+ public Stock getById(@PathVariable("id") Integer id) {
+ return stockService.get(id);
+ }
+
+ @GetMapping(value = "/batch/update")
+ public void batchUpdateCond() {
+ try {
+ stockService.batchUpdate();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @GetMapping(value = "/batch/delete")
+ public void batchDeleteCond() {
+ try {
+ stockService.batchDelete();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/Stock.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/Stock.java
new file mode 100644
index 00000000..68605249
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/Stock.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.stockservice.persistence;
+
+public class Stock {
+ private Integer id;
+
+ private String commodityCode;
+
+ private Integer count;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getCommodityCode() {
+ return commodityCode;
+ }
+
+ public void setCommodityCode(String commodityCode) {
+ this.commodityCode = commodityCode;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/StockMapper.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/StockMapper.java
new file mode 100644
index 00000000..f8225297
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/persistence/StockMapper.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.stockservice.persistence;
+
+import java.util.List;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface StockMapper {
+
+ Stock selectById(@Param("id") Integer id);
+
+ Stock findByCommodityCode(@Param("commodityCode") String commodityCode);
+
+ int updateById(Stock record);
+
+ void insert(Stock record);
+
+ void insertBatch(List records);
+
+ int updateBatch(@Param("list") List ids, @Param("commodityCode") String commodityCode);
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/service/StockService.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/service/StockService.java
new file mode 100644
index 00000000..0c603dfc
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/java/mybatisflex/test/stockservice/service/StockService.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 1999-2021 Seata.io Group.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package mybatisflex.test.stockservice.service;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import javax.sql.DataSource;
+import io.seata.spring.annotation.GlobalLock;
+import io.seata.spring.annotation.GlobalTransactional;
+import mybatisflex.test.stockservice.persistence.Stock;
+import mybatisflex.test.stockservice.persistence.StockMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StockService {
+
+ @Autowired
+ private StockMapper stockMapper;
+ @Autowired
+ private DataSource dataSource;
+
+ public void deduct(String commodityCode, int count) {
+ //There is a latent isolation problem here.
+ //I hope that users can solve it and deepen their understanding of seata isolation.
+ //At the bottom I will put a reference solution.
+ Stock stock = stockMapper.findByCommodityCode(commodityCode);
+ stock.setCount(stock.getCount() - count);
+ stockMapper.updateById(stock);
+ }
+
+ @GlobalLock
+ public Stock get(Integer id) {
+ return stockMapper.selectById(id);
+ }
+
+ /**
+ * 0.8.0 release
+ *
+ * @throws SQLException
+ */
+ @GlobalTransactional
+ public void batchUpdate() throws SQLException {
+ Connection connection = null;
+ PreparedStatement preparedStatement = null;
+ try {
+ connection = dataSource.getConnection();
+ connection.setAutoCommit(false);
+ String sql = "update stock_tbl set count = ?" + " where id = ? and commodity_code = ?";
+ preparedStatement = connection.prepareStatement(sql);
+ preparedStatement.setInt(1, 100);
+ preparedStatement.setLong(2, 1);
+ preparedStatement.setString(3, "2001");
+ preparedStatement.addBatch();
+ preparedStatement.setInt(1, 200);
+ preparedStatement.setLong(2, 2);
+ preparedStatement.setString(3, "2002");
+ preparedStatement.addBatch();
+ preparedStatement.setInt(1, 300);
+ preparedStatement.setLong(2, 3);
+ preparedStatement.setString(3, "2003");
+ preparedStatement.addBatch();
+ preparedStatement.executeBatch();
+ connection.commit();
+ System.out.println(1 / 0);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ connection.close();
+ preparedStatement.close();
+ }
+ }
+
+ /**
+ * 0.8.0 release
+ *
+ * @throws SQLException
+ */
+ @GlobalTransactional
+ public void batchDelete() throws SQLException {
+ Connection connection = null;
+ PreparedStatement preparedStatement = null;
+ try {
+ connection = dataSource.getConnection();
+ connection.setAutoCommit(false);
+ String sql = "delete from stock_tbl where count = ? and commodity_code = ?";
+ preparedStatement = connection.prepareStatement(sql);
+ preparedStatement.setInt(1, 11);
+ preparedStatement.setString(2, "2001");
+ preparedStatement.addBatch();
+ preparedStatement.setInt(1, 22);
+ preparedStatement.setString(2, "2002");
+ preparedStatement.addBatch();
+ preparedStatement.setInt(1, 33);
+ preparedStatement.setString(2, "2003");
+ preparedStatement.addBatch();
+ preparedStatement.executeBatch();
+ connection.commit();
+ System.out.println(1 / 0);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ connection.close();
+ preparedStatement.close();
+ }
+ }
+}
+
+/*
+reference solution:
+ @Transactional
+ public void deduct(String commodityCode, int count) {
+ //select + for update
+ Stock stock = stockMapper.findByCommodityCode(commodityCode);
+ stock.setCount(stock.getCount() - count);
+ stockMapper.updateById(stock);
+ }
+ 1.select for update,refer https://seata.io/zh-cn/docs/overview/faq.html#4
+ 2.(optional)use @Transactional,keep X locks held until connection submission
+*/
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/application.yml
new file mode 100755
index 00000000..ee162b51
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/application.yml
@@ -0,0 +1,118 @@
+server:
+ port: 8081
+spring:
+ main:
+ allow-circular-references: true
+ datasource:
+ driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:mysql://127.0.0.1:3306/db_stock?useSSL=false&serverTimezone=UTC
+ username: root
+ password: 131496
+seata:
+ enabled: true
+ application-id: stock-service
+ tx-service-group: my_test_tx_group
+# enable-auto-data-source-proxy: false
+ #use-jdk-proxy: false
+ client:
+ rm:
+ async-commit-buffer-limit: 1000
+ report-retry-count: 5
+ table-meta-check-enable: false
+ report-success-enable: false
+ lock:
+ retry-interval: 10
+ retry-times: 30
+ retry-policy-branch-rollback-on-conflict: true
+ tm:
+ commit-retry-count: 5
+ rollback-retry-count: 5
+ undo:
+ data-validation: true
+ log-serialization: jackson
+ log-table: undo_log
+ log:
+ exceptionRate: 100
+ service:
+ vgroup-mapping:
+ my_test_tx_group: default
+ grouplist:
+ default: 127.0.0.1:8091
+ #enable-degrade: false
+ #disable-global-transaction: false
+ transport:
+ shutdown:
+ wait: 3
+ thread-factory:
+ boss-thread-prefix: NettyBoss
+ worker-thread-prefix: NettyServerNIOWorker
+ server-executor-thread-prefix: NettyServerBizHandler
+ share-boss-worker: false
+ client-selector-thread-prefix: NettyClientSelector
+ client-selector-thread-size: 1
+ client-worker-thread-prefix: NettyClientWorkerThread
+ worker-thread-size: default
+ boss-thread-size: 1
+ type: TCP
+ server: NIO
+ heartbeat: true
+ serialization: seata
+ compressor: none
+ enable-client-batch-send-request: true
+ config:
+ type: file
+ consul:
+ server-addr: 127.0.0.1:8500
+ apollo:
+ apollo-meta: http://192.168.1.204:8801
+ app-id: seata-server
+ namespace: application
+ etcd3:
+ server-addr: http://localhost:2379
+ nacos:
+ namespace:
+ serverAddr: localhost
+ group: SEATA_GROUP
+ zk:
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
+ registry:
+ type: file
+ consul:
+ cluster: default
+ server-addr: 127.0.0.1:8500
+ etcd3:
+ cluster: default
+ serverAddr: http://localhost:2379
+ eureka:
+ application: default
+ weight: 1
+ service-url: http://localhost:8761/eureka
+ nacos:
+ cluster: default
+ server-addr: localhost
+ namespace:
+ redis:
+ server-addr: localhost:6379
+ db: 0
+ password:
+ cluster: default
+ timeout: 0
+ sofa:
+ server-addr: 127.0.0.1:9603
+ application: default
+ region: DEFAULT_ZONE
+ datacenter: DefaultDataCenter
+ cluster: default
+ group: SEATA_GROUP
+ addressWaitTime: 3000
+ zk:
+ cluster: default
+ server-addr: 127.0.0.1:2181
+ session-timeout: 6000
+ connect-timeout: 2000
+ username: ""
+ password: ""
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/mapper/StorageMapper.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/mapper/StorageMapper.xml
new file mode 100644
index 00000000..9fd9327a
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/main/resources/mapper/StorageMapper.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update stock_tbl
+ set count = #{count,jdbcType=INTEGER}
+ WHERE id = #{id}
+
+
+
+ insert into stock_tbl (commodity_code, count)
+ values (#{commodityCode,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER})
+
+
+
+ insert into stock_tbl (commodity_code, count)
+ values
+
+ (#{item.commodityCode,jdbcType=VARCHAR}, #{item.count,jdbcType=INTEGER})
+
+
+
+
+ update stock_tbl set count = 100
+ WHERE id IN
+
+ #{item}
+
+ and commodity_code = #{commodityCode,jdbcType=VARCHAR}
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/test/java/mybatisflex/test/stockservice/StockServiceApplicationTests.java b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/test/java/mybatisflex/test/stockservice/StockServiceApplicationTests.java
new file mode 100644
index 00000000..85a82432
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata-demo/stock-service/src/test/java/mybatisflex/test/stockservice/StockServiceApplicationTests.java
@@ -0,0 +1,13 @@
+package mybatisflex.test.stockservice;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class StockServiceApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata/pom.xml b/mybatis-flex-test/mybatis-flex-spring-boot-seata/pom.xml
index 6e1055b1..85f2e4ad 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-seata/pom.xml
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata/pom.xml
@@ -25,7 +25,7 @@
com.mybatis-flexmybatis-flex-codegen
- 1.5.6
+ ${mybatis-flex.version}
@@ -91,12 +91,6 @@
RELEASEcompile
-
-
- io.seata
- seata-spring-boot-starter
- 1.7.0
-
diff --git a/mybatis-flex-test/mybatis-flex-spring-boot-seata/src/main/resources/application.yml b/mybatis-flex-test/mybatis-flex-spring-boot-seata/src/main/resources/application.yml
index 97c7b42c..2000304f 100644
--- a/mybatis-flex-test/mybatis-flex-spring-boot-seata/src/main/resources/application.yml
+++ b/mybatis-flex-test/mybatis-flex-spring-boot-seata/src/main/resources/application.yml
@@ -1,3 +1,4 @@
+
mybatis-flex:
seata-config:
enable: true #启动seata
diff --git a/mybatis-flex-test/pom.xml b/mybatis-flex-test/pom.xml
index de11100a..c2ddea99 100644
--- a/mybatis-flex-test/pom.xml
+++ b/mybatis-flex-test/pom.xml
@@ -19,6 +19,7 @@
mybatis-flex-spring-boot-testmybatis-flex-spring-cloud-testmybatis-flex-spring-boot-seata
+ mybatis-flex-spring-boot-seata-demo