Browse Source

Merge pull request #7378 from EightMonth/springboot3_sas

分布式事务demo修复
springboot3_sas
JEECG 2 days ago committed by GitHub
parent
commit
f43d0d486b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/JeecgAuthenticationConvert.java
  2. 10
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/JeecgPermissionService.java
  3. 5
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/SecurityConfig.java
  4. 2
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/app/AppGrantAuthenticationProvider.java
  5. 2
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/password/PasswordGrantAuthenticationProvider.java
  6. 2
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/phone/PhoneGrantAuthenticationProvider.java
  7. 5
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/self/SelfAuthenticationProvider.java
  8. 2
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/social/SocialGrantAuthenticationProvider.java
  9. 146
      jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/db/seata.sql
  10. 9
      jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-account/src/main/resources/application.yml
  11. 10
      jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-order/src/main/resources/application.yml
  12. 11
      jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-product/src/main/resources/application.yml
  13. 6
      jeecg-boot/pom.xml

8
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/JeecgAuthenticationConvert.java

@ -1,8 +1,9 @@
package org.jeecg.config.security; package org.jeecg.config.security;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.CommonAPI; import org.jeecg.common.api.CommonAPI;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.Converter;
import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -18,10 +19,11 @@ import java.util.ArrayList;
* @date 2024/7/15 11:05 * @date 2024/7/15 11:05
*/ */
@Component @Component
@RequiredArgsConstructor
public class JeecgAuthenticationConvert implements Converter<Jwt, AbstractAuthenticationToken> { public class JeecgAuthenticationConvert implements Converter<Jwt, AbstractAuthenticationToken> {
private final CommonAPI commonAPI; @Lazy
@Autowired
private CommonAPI commonAPI;
@Override @Override
public AbstractAuthenticationToken convert(Jwt source) { public AbstractAuthenticationToken convert(Jwt source) {

10
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/JeecgPermissionService.java

@ -7,6 +7,8 @@ import org.jeecg.common.api.CommonAPI;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.config.security.utils.SecureUtil; import org.jeecg.config.security.utils.SecureUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.PatternMatchUtils; import org.springframework.util.PatternMatchUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@ -21,14 +23,16 @@ import java.util.Set;
* @date 2024/1/10 17:00 * @date 2024/1/10 17:00
*/ */
@Service("jps") @Service("jps")
@AllArgsConstructor
@Slf4j @Slf4j
public class JeecgPermissionService { public class JeecgPermissionService {
private final String SPLIT = "::"; private final String SPLIT = "::";
private final String PERM_PREFIX = "jps" + SPLIT; private final String PERM_PREFIX = "jps" + SPLIT;
private final CommonAPI commonAPI; @Lazy
private final RedisUtil redisUtil; @Autowired
private CommonAPI commonAPI;
@Autowired
private RedisUtil redisUtil;
/** /**
* 判断接口是否有任意xxxxxx权限 * 判断接口是否有任意xxxxxx权限

5
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/SecurityConfig.java

@ -16,6 +16,7 @@ import org.jeecg.config.security.phone.PhoneGrantAuthenticationConvert;
import org.jeecg.config.security.phone.PhoneGrantAuthenticationProvider; import org.jeecg.config.security.phone.PhoneGrantAuthenticationProvider;
import org.jeecg.config.security.social.SocialGrantAuthenticationConvert; import org.jeecg.config.security.social.SocialGrantAuthenticationConvert;
import org.jeecg.config.security.social.SocialGrantAuthenticationProvider; import org.jeecg.config.security.social.SocialGrantAuthenticationProvider;
import org.jeecg.config.shiro.ignore.InMemoryIgnoreAuth;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
@ -42,6 +43,8 @@ import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher; import org.springframework.security.web.util.matcher.MediaTypeRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.util.CollectionUtils;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import java.security.KeyPair; import java.security.KeyPair;
@ -50,6 +53,7 @@ import java.security.SecureRandom;
import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.ECPublicKey; import java.security.interfaces.ECPublicKey;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors;
/** /**
* spring authorization server核心配置 * spring authorization server核心配置
@ -102,6 +106,7 @@ public class SecurityConfig {
http http
//设置所有请求都需要认证,未认证的请求都被重定向到login页面进行登录 //设置所有请求都需要认证,未认证的请求都被重定向到login页面进行登录
.authorizeHttpRequests((authorize) -> authorize .authorizeHttpRequests((authorize) -> authorize
.requestMatchers(InMemoryIgnoreAuth.get().stream().map(AntPathRequestMatcher::antMatcher).toList().toArray(new AntPathRequestMatcher[0])).permitAll()
.requestMatchers(AntPathRequestMatcher.antMatcher("/sys/cas/client/validateLogin")).permitAll() .requestMatchers(AntPathRequestMatcher.antMatcher("/sys/cas/client/validateLogin")).permitAll()
.requestMatchers(AntPathRequestMatcher.antMatcher("/sys/randomImage/**")).permitAll() .requestMatchers(AntPathRequestMatcher.antMatcher("/sys/randomImage/**")).permitAll()
.requestMatchers(AntPathRequestMatcher.antMatcher("/sys/checkCaptcha")).permitAll() .requestMatchers(AntPathRequestMatcher.antMatcher("/sys/checkCaptcha")).permitAll()

2
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/app/AppGrantAuthenticationProvider.java

@ -17,6 +17,7 @@ import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.config.security.password.PasswordGrantAuthenticationToken; import org.jeecg.config.security.password.PasswordGrantAuthenticationToken;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -55,6 +56,7 @@ public class AppGrantAuthenticationProvider implements AuthenticationProvider {
private final OAuth2AuthorizationService authorizationService; private final OAuth2AuthorizationService authorizationService;
private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator; private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator;
@Lazy
@Autowired @Autowired
private CommonAPI commonAPI; private CommonAPI commonAPI;
@Autowired @Autowired

2
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/password/PasswordGrantAuthenticationProvider.java

@ -16,6 +16,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.JeecgBaseConfig; import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -56,6 +57,7 @@ public class PasswordGrantAuthenticationProvider implements AuthenticationProvid
private final OAuth2AuthorizationService authorizationService; private final OAuth2AuthorizationService authorizationService;
private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator; private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator;
@Lazy
@Autowired @Autowired
private CommonAPI commonAPI; private CommonAPI commonAPI;
@Autowired @Autowired

2
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/phone/PhoneGrantAuthenticationProvider.java

@ -16,6 +16,7 @@ import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.config.security.password.PasswordGrantAuthenticationToken; import org.jeecg.config.security.password.PasswordGrantAuthenticationToken;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@ -53,6 +54,7 @@ public class PhoneGrantAuthenticationProvider implements AuthenticationProvider
private final OAuth2AuthorizationService authorizationService; private final OAuth2AuthorizationService authorizationService;
private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator; private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator;
@Lazy
@Autowired @Autowired
private CommonAPI commonAPI; private CommonAPI commonAPI;
@Autowired @Autowired

5
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/self/SelfAuthenticationProvider.java

@ -1,17 +1,15 @@
package org.jeecg.config.security.self; package org.jeecg.config.security.self;
import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.CommonAPI; import org.jeecg.common.api.CommonAPI;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBoot401Exception; import org.jeecg.common.exception.JeecgBoot401Exception;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysDepartModel;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.JeecgBaseConfig; import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
@ -48,6 +46,7 @@ public class SelfAuthenticationProvider implements AuthenticationProvider {
private final OAuth2AuthorizationService authorizationService; private final OAuth2AuthorizationService authorizationService;
private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator; private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator;
@Lazy
@Autowired @Autowired
private CommonAPI commonAPI; private CommonAPI commonAPI;
@Autowired @Autowired

2
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/security/social/SocialGrantAuthenticationProvider.java

@ -15,6 +15,7 @@ import org.jeecg.config.JeecgBaseConfig;
import org.jeecg.config.security.password.PasswordGrantAuthenticationToken; import org.jeecg.config.security.password.PasswordGrantAuthenticationToken;
import org.jeecg.modules.base.service.BaseCommonService; import org.jeecg.modules.base.service.BaseCommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
@ -51,6 +52,7 @@ public class SocialGrantAuthenticationProvider implements AuthenticationProvider
private final OAuth2AuthorizationService authorizationService; private final OAuth2AuthorizationService authorizationService;
private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator; private final OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator;
@Lazy
@Autowired @Autowired
private CommonAPI commonAPI; private CommonAPI commonAPI;
@Autowired @Autowired

146
jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/db/seata.sql

@ -1,79 +1,77 @@
/* -- -------------------------------- The script used when storeMode is 'db' --------------------------------
Navicat Premium Data Transfer -- the table to store GlobalSession data
DROP TABLE IF EXISTS `global_table`;
Source Server : localhost CREATE TABLE IF NOT EXISTS `global_table`
Source Server Type : MariaDB (
Source Server Version : 100316 `xid` VARCHAR(128) NOT NULL,
Source Host : localhost:3300 `transaction_id` BIGINT,
Source Schema : seata `status` TINYINT NOT NULL,
`application_id` VARCHAR(32),
Target Server Type : MariaDB `transaction_service_group` VARCHAR(32),
Target Server Version : 100316 `transaction_name` VARCHAR(128),
File Encoding : 65001 `timeout` INT,
`begin_time` BIGINT,
Date: 05/01/2022 20:25:07 `application_data` VARCHAR(2000),
*/ `gmt_create` DATETIME,
`gmt_modified` DATETIME,
SET NAMES utf8mb4; PRIMARY KEY (`xid`),
SET FOREIGN_KEY_CHECKS = 0; KEY `idx_status_gmt_modified` (`status` , `gmt_modified`),
KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- ---------------------------- -- the table to store BranchSession data
-- Table structure for branch_table
-- ----------------------------
DROP TABLE IF EXISTS `branch_table`; DROP TABLE IF EXISTS `branch_table`;
CREATE TABLE `branch_table` ( CREATE TABLE IF NOT EXISTS `branch_table`
`branch_id` bigint(20) NOT NULL, (
`xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `branch_id` BIGINT NOT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL, `xid` VARCHAR(128) NOT NULL,
`resource_group_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `transaction_id` BIGINT,
`resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `resource_group_id` VARCHAR(32),
`branch_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `resource_id` VARCHAR(256),
`status` tinyint(4) NULL DEFAULT NULL, `branch_type` VARCHAR(8),
`client_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `status` TINYINT,
`application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `client_id` VARCHAR(64),
`gmt_create` datetime(6) NULL DEFAULT NULL, `application_data` VARCHAR(2000),
`gmt_modified` datetime(6) NULL DEFAULT NULL, `gmt_create` DATETIME(6),
PRIMARY KEY (`branch_id`) USING BTREE, `gmt_modified` DATETIME(6),
INDEX `idx_xid`(`xid`) USING BTREE PRIMARY KEY (`branch_id`),
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
-- ---------------------------- DEFAULT CHARSET = utf8mb4;
-- Table structure for global_table
-- ----------------------------
DROP TABLE IF EXISTS `global_table`;
CREATE TABLE `global_table` (
`xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL,
`status` tinyint(4) NOT NULL,
`application_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`transaction_service_group` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`transaction_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`timeout` int(11) NULL DEFAULT NULL,
`begin_time` bigint(20) NULL DEFAULT NULL,
`application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`gmt_create` datetime(0) NULL DEFAULT NULL,
`gmt_modified` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`xid`) USING BTREE,
INDEX `idx_gmt_modified_status`(`gmt_modified`, `status`) USING BTREE,
INDEX `idx_transaction_id`(`transaction_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ---------------------------- -- the table to store lock data
-- Table structure for lock_table
-- ----------------------------
DROP TABLE IF EXISTS `lock_table`; DROP TABLE IF EXISTS `lock_table`;
CREATE TABLE `lock_table` ( CREATE TABLE IF NOT EXISTS `lock_table`
`row_key` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, (
`xid` varchar(96) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `row_key` VARCHAR(128) NOT NULL,
`transaction_id` bigint(20) NULL DEFAULT NULL, `xid` VARCHAR(128),
`branch_id` bigint(20) NOT NULL, `transaction_id` BIGINT,
`resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `branch_id` BIGINT NOT NULL,
`table_name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `resource_id` VARCHAR(256),
`pk` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `table_name` VARCHAR(32),
`gmt_create` datetime(0) NULL DEFAULT NULL, `pk` VARCHAR(36),
`gmt_modified` datetime(0) NULL DEFAULT NULL, `status` TINYINT NOT NULL DEFAULT '0' COMMENT '0:locked ,1:rollbacking',
PRIMARY KEY (`row_key`) USING BTREE, `gmt_create` DATETIME,
INDEX `idx_branch_id`(`branch_id`) USING BTREE `gmt_modified` DATETIME,
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; PRIMARY KEY (`row_key`),
KEY `idx_status` (`status`),
KEY `idx_branch_id` (`branch_id`),
KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
DROP TABLE IF EXISTS `distributed_lock`;
CREATE TABLE IF NOT EXISTS `distributed_lock`
(
`lock_key` CHAR(20) NOT NULL,
`lock_value` VARCHAR(20) NOT NULL,
`expire` BIGINT,
primary key (`lock_key`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
SET FOREIGN_KEY_CHECKS = 1; INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('AsyncCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryCommitting', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('RetryRollbacking', ' ', 0);
INSERT INTO `distributed_lock` (lock_key, lock_value, expire) VALUES ('TxTimeoutCheck', ' ', 0);

9
jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-account/src/main/resources/application.yml

@ -15,13 +15,8 @@ spring:
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
autoconfigure: autoconfigure:
exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration
datasource: datasource:
dynamic:
seata: true # 开启对 seata的支持
primary: account
datasource:
account:
url: jdbc:mysql://127.0.0.1:3306/jeecg_account?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true url: jdbc:mysql://127.0.0.1:3306/jeecg_account?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true
username: root username: root
password: root password: root
@ -33,7 +28,7 @@ spring:
import-check: import-check:
enabled: false enabled: false
seata: seata:
enable-auto-data-source-proxy: true # enable-auto-data-source-proxy: true
service: service:
grouplist: grouplist:
default: 127.0.0.1:8091 default: 127.0.0.1:8091

10
jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-order/src/main/resources/application.yml

@ -15,14 +15,8 @@ spring:
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
autoconfigure: autoconfigure:
exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration
datasource: datasource:
dynamic:
primary: order
seata: true # 开启对 seata的支持
datasource:
# 设置 账号数据源配置
order:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/jeecg_order?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useSSL=false url: jdbc:mysql://127.0.0.1:3306/jeecg_order?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useSSL=false
username: root username: root
@ -34,7 +28,7 @@ spring:
import-check: import-check:
enabled: false enabled: false
seata: seata:
enable-auto-data-source-proxy: false # enable-auto-data-source-proxy: false
service: service:
grouplist: grouplist:
default: 127.0.0.1:8091 default: 127.0.0.1:8091

11
jeecg-boot/jeecg-server-cloud/jeecg-visual/jeecg-cloud-test/jeecg-cloud-test-seata/jeecg-cloud-test-seata-product/src/main/resources/application.yml

@ -14,14 +14,9 @@ spring:
name: seata-product name: seata-product
main: main:
allow-bean-definition-overriding: true allow-bean-definition-overriding: true
autoconfigure:
exclude: com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration
datasource: datasource:
dynamic:
primary: product
seata: true # 开启对 seata的支持
seata-mode: AT #支持XA及AT模式,默认AT
datasource:
# 设置 账号数据源配置
product:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/jeecg_product?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useSSL=false url: jdbc:mysql://127.0.0.1:3306/jeecg_product?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useSSL=false
username: root username: root
@ -33,7 +28,7 @@ spring:
import-check: import-check:
enabled: false enabled: false
seata: seata:
enable-auto-data-source-proxy: false # enable-auto-data-source-proxy: false
service: service:
grouplist: grouplist:
default: 127.0.0.1:8091 default: 127.0.0.1:8091

6
jeecg-boot/pom.xml

@ -36,7 +36,6 @@
<spring-cloud.version>2022.0.4</spring-cloud.version> <spring-cloud.version>2022.0.4</spring-cloud.version>
<spring-cloud-alibaba.version>2022.0.0.0</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2022.0.0.0</spring-cloud-alibaba.version>
<alibaba.nacos.version>2.0.4</alibaba.nacos.version> <alibaba.nacos.version>2.0.4</alibaba.nacos.version>
<seata.version>1.5.2</seata.version>
<xxl-job-core.version>2.4.1</xxl-job-core.version> <xxl-job-core.version>2.4.1</xxl-job-core.version>
<fastjson.version>2.0.43</fastjson.version> <fastjson.version>2.0.43</fastjson.version>
@ -171,11 +170,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>${seata.version}</version>
</dependency>
<!-- system 模块--> <!-- system 模块-->
<dependency> <dependency>

Loading…
Cancel
Save