mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 17:18:24 +08:00
refactor: 移动 SeataMode 类到 starter 模块。
This commit is contained in:
parent
3142ec66ec
commit
8d498c930b
@ -19,7 +19,6 @@ import com.mybatisflex.core.datasource.DataSourceBuilder;
|
|||||||
import com.mybatisflex.core.datasource.DataSourceDecipher;
|
import com.mybatisflex.core.datasource.DataSourceDecipher;
|
||||||
import com.mybatisflex.core.datasource.DataSourceManager;
|
import com.mybatisflex.core.datasource.DataSourceManager;
|
||||||
import com.mybatisflex.core.datasource.FlexDataSource;
|
import com.mybatisflex.core.datasource.FlexDataSource;
|
||||||
import com.mybatisflex.spring.SeataMode;
|
|
||||||
import com.mybatisflex.spring.boot.MybatisFlexProperties.SeataConfig;
|
import com.mybatisflex.spring.boot.MybatisFlexProperties.SeataConfig;
|
||||||
import com.mybatisflex.spring.datasource.DataSourceAdvice;
|
import com.mybatisflex.spring.datasource.DataSourceAdvice;
|
||||||
import io.seata.rm.datasource.DataSourceProxy;
|
import io.seata.rm.datasource.DataSourceProxy;
|
||||||
@ -87,7 +86,7 @@ public class MultiDataSourceAutoConfiguration {
|
|||||||
DataSourceManager.decryptDataSource(dataSource);
|
DataSourceManager.decryptDataSource(dataSource);
|
||||||
|
|
||||||
if (seataConfig != null && seataConfig.isEnable()) {
|
if (seataConfig != null && seataConfig.isEnable()) {
|
||||||
if (seataConfig.getSeataMode() == SeataMode.XA) {
|
if (seataConfig.getSeataMode() == MybatisFlexProperties.SeataMode.XA) {
|
||||||
dataSource = new DataSourceProxyXA(dataSource);
|
dataSource = new DataSourceProxyXA(dataSource);
|
||||||
} else {
|
} else {
|
||||||
dataSource = new DataSourceProxy(dataSource);
|
dataSource = new DataSourceProxy(dataSource);
|
||||||
|
|||||||
@ -17,7 +17,6 @@ package com.mybatisflex.spring.boot;
|
|||||||
|
|
||||||
import com.mybatisflex.core.FlexConsts;
|
import com.mybatisflex.core.FlexConsts;
|
||||||
import com.mybatisflex.core.FlexGlobalConfig;
|
import com.mybatisflex.core.FlexGlobalConfig;
|
||||||
import com.mybatisflex.spring.SeataMode;
|
|
||||||
import org.apache.ibatis.io.VFS;
|
import org.apache.ibatis.io.VFS;
|
||||||
import org.apache.ibatis.logging.Log;
|
import org.apache.ibatis.logging.Log;
|
||||||
import org.apache.ibatis.mapping.ResultSetType;
|
import org.apache.ibatis.mapping.ResultSetType;
|
||||||
@ -42,6 +41,7 @@ import java.util.stream.Stream;
|
|||||||
/**
|
/**
|
||||||
* Mybatis-Flex 的配置属性。
|
* 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
|
* 参考: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 Eddú Meléndez
|
||||||
* @author Kazuki Shimizu
|
* @author Kazuki Shimizu
|
||||||
* @author micahel
|
* @author micahel
|
||||||
@ -909,7 +909,7 @@ public class MybatisFlexProperties {
|
|||||||
*
|
*
|
||||||
* @author life
|
* @author life
|
||||||
*/
|
*/
|
||||||
public static class SeataConfig{
|
public static class SeataConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否开启
|
* 是否开启
|
||||||
@ -936,6 +936,18 @@ public class MybatisFlexProperties {
|
|||||||
public void setSeataMode(SeataMode seataMode) {
|
public void setSeataMode(SeataMode seataMode) {
|
||||||
this.seataMode = seataMode;
|
this.seataMode = seataMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author life
|
||||||
|
*/
|
||||||
|
public enum SeataMode {
|
||||||
|
|
||||||
|
XA,
|
||||||
|
|
||||||
|
AT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user