refactor: 移动 SeataMode 类到 starter 模块。

This commit is contained in:
Suomm 2023-08-09 13:03:28 +08:00
parent 3142ec66ec
commit 8d498c930b
3 changed files with 15 additions and 30 deletions

View File

@ -19,7 +19,6 @@ 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;
@ -87,7 +86,7 @@ public class MultiDataSourceAutoConfiguration {
DataSourceManager.decryptDataSource(dataSource);
if (seataConfig != null && seataConfig.isEnable()) {
if (seataConfig.getSeataMode() == SeataMode.XA) {
if (seataConfig.getSeataMode() == MybatisFlexProperties.SeataMode.XA) {
dataSource = new DataSourceProxyXA(dataSource);
} else {
dataSource = new DataSourceProxy(dataSource);

View File

@ -17,7 +17,6 @@ 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;
@ -42,6 +41,7 @@ import java.util.stream.Stream;
/**
* Mybatis-Flex 的配置属性
* 参考https://github.com/mybatis/spring-boot-starter/blob/master/mybatis-spring-boot-autoconfigure/src/main/java/org/mybatis/spring/boot/autoconfigure/MybatisProperties.java
*
* @author Eddú Meléndez
* @author Kazuki Shimizu
* @author micahel
@ -936,6 +936,18 @@ public class MybatisFlexProperties {
public void setSeataMode(SeataMode seataMode) {
this.seataMode = seataMode;
}
}
/**
* @author life
*/
public enum SeataMode {
XA,
AT
}
}

View File

@ -1,26 +0,0 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.mybatisflex.spring;
/**
* @author life
*/
public enum SeataMode {
XA,
AT
}