mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-10-14 14:10:24 +00:00
update seata-server 2.3.0 => 2.4.0 (注意此版本改动较多 升级需要严格根据提交记录处理)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<revision>2.4.0</revision>
|
||||
<spring-cloud-alibaba.version>2023.0.1.2</spring-cloud-alibaba.version>
|
||||
<sentinel.version>1.8.8</sentinel.version>
|
||||
<seata.version>2.3.0</seata.version>
|
||||
<seata.version>2.4.0</seata.version>
|
||||
<nacos.client.version>2.5.1</nacos.client.version>
|
||||
<dubbo.version>3.3.4</dubbo.version>
|
||||
<dubbo-extensions.version>3.3.1</dubbo-extensions.version>
|
||||
|
@@ -1,8 +1,6 @@
|
||||
package org.dromara.common.seata.config;
|
||||
|
||||
import org.dromara.common.core.factory.YmlPropertySourceFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
/**
|
||||
* seata 配置
|
||||
@@ -10,7 +8,6 @@ import org.springframework.context.annotation.PropertySource;
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@PropertySource(value = "classpath:common-seata.yml", factory = YmlPropertySourceFactory.class)
|
||||
public class SeataConfiguration {
|
||||
|
||||
}
|
||||
|
@@ -1,23 +0,0 @@
|
||||
# 内置配置 不允许修改 如需修改请在 nacos 上写相同配置覆盖
|
||||
# seata配置
|
||||
seata:
|
||||
config:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.server-addr}
|
||||
group: ${spring.cloud.nacos.config.group}
|
||||
namespace: ${spring.profiles.active}
|
||||
username: ${spring.cloud.nacos.username}
|
||||
password: ${spring.cloud.nacos.password}
|
||||
data-id: seata-server.properties
|
||||
registry:
|
||||
type: nacos
|
||||
nacos:
|
||||
application: ruoyi-seata-server
|
||||
server-addr: ${spring.cloud.nacos.server-addr}
|
||||
group: ${spring.cloud.nacos.discovery.group}
|
||||
username: ${spring.cloud.nacos.username}
|
||||
password: ${spring.cloud.nacos.password}
|
||||
namespace: ${spring.profiles.active}
|
||||
# 关闭自动代理
|
||||
enable-auto-data-source-proxy: false
|
@@ -27,7 +27,7 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<seata.version>2.3.0</seata.version>
|
||||
<seata.version>2.4.0</seata.version>
|
||||
<spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
|
||||
<spring-framework-for-server.version>5.3.39</spring-framework-for-server.version>
|
||||
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
|
||||
@@ -161,6 +161,12 @@
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-core</artifactId>
|
||||
@@ -199,11 +205,11 @@
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-console</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.seata</groupId>-->
|
||||
<!-- <artifactId>seata-namingserver</artifactId>-->
|
||||
<!-- <version>${seata.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- for database -->
|
||||
<dependency>
|
||||
|
@@ -16,13 +16,14 @@
|
||||
*/
|
||||
package org.apache.seata.core.store.db;
|
||||
|
||||
import org.apache.seata.common.ConfigurationKeys;
|
||||
import org.apache.seata.common.exception.ShouldNeverHappenException;
|
||||
import org.apache.seata.common.exception.StoreException;
|
||||
import org.apache.seata.common.executor.Initialize;
|
||||
import org.apache.seata.common.util.ConfigTools;
|
||||
import org.apache.seata.common.util.StringUtils;
|
||||
import org.apache.seata.config.Configuration;
|
||||
import org.apache.seata.config.ConfigurationFactory;
|
||||
import org.apache.seata.core.constants.ConfigurationKeys;
|
||||
import org.apache.seata.core.constants.DBType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -55,13 +56,13 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
*/
|
||||
protected static final Configuration CONFIG = ConfigurationFactory.getInstance();
|
||||
|
||||
private final static String MYSQL_DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
|
||||
private static final String MYSQL_DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
|
||||
|
||||
private final static String MYSQL8_DRIVER_CLASS_NAME = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String MYSQL8_DRIVER_CLASS_NAME = "com.mysql.cj.jdbc.Driver";
|
||||
|
||||
private final static String MYSQL_DRIVER_FILE_PREFIX = "mysql-connector-java-";
|
||||
private static final String MYSQL_DRIVER_FILE_PREFIX = "mysql-connector-j";
|
||||
|
||||
private final static Map<String, ClassLoader> MYSQL_DRIVER_LOADERS;
|
||||
private static final Map<String, ClassLoader> MYSQL_DRIVER_LOADERS;
|
||||
|
||||
private static final long DEFAULT_DB_MAX_WAIT = 5000;
|
||||
|
||||
@@ -85,7 +86,7 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
//valid driver class name
|
||||
// valid driver class name
|
||||
String driverClassName = getDriverClassName();
|
||||
// ClassLoader loader = getDriverClassLoader();
|
||||
// if (null == loader) {
|
||||
@@ -95,15 +96,31 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
// loader.loadClass(driverClassName);
|
||||
Class.forName(driverClassName);
|
||||
} catch (ClassNotFoundException exx) {
|
||||
String driverClassPath = null;
|
||||
String folderPath = System.getProperty("loader.path");
|
||||
if (null != folderPath) {
|
||||
driverClassPath = folderPath + "/jdbc/";
|
||||
if (folderPath == null) {
|
||||
folderPath = System.getProperty("java.class.path");
|
||||
}
|
||||
String driverClassPath = Stream.of(folderPath.split(File.pathSeparator))
|
||||
.map(File::new)
|
||||
.filter(File::exists)
|
||||
.map(file -> file.isFile() ? file.getParentFile() : file)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(File::isDirectory)
|
||||
// Only the MySQL driver needs to be placed in the jdbc folder.
|
||||
.map(file -> (MYSQL8_DRIVER_CLASS_NAME.equals(driverClassName)
|
||||
|| MYSQL_DRIVER_CLASS_NAME.equals(driverClassName))
|
||||
? new File(file, "jdbc")
|
||||
: file)
|
||||
.filter(File::exists)
|
||||
.filter(File::isDirectory)
|
||||
.distinct()
|
||||
.findAny()
|
||||
.map(File::getAbsolutePath)
|
||||
.orElseThrow(() -> new ShouldNeverHappenException("cannot find jdbc folder"));
|
||||
throw new StoreException(String.format(
|
||||
"The driver {%s} cannot be found in the path %s. Please ensure that the appropriate database driver dependencies are included in the classpath.", driverClassName, driverClassPath));
|
||||
"The driver {%s} cannot be found in the path %s. Please ensure that the appropriate database driver dependencies are included in the classpath.",
|
||||
driverClassName, driverClassPath));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* generate the datasource
|
||||
@@ -140,17 +157,20 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
* @return the db max wait
|
||||
*/
|
||||
protected Long getMaxWait() {
|
||||
Long maxWait = CONFIG.getLong(ConfigurationKeys.STORE_DB_MAX_WAIT, DEFAULT_DB_MAX_WAIT);
|
||||
return maxWait;
|
||||
return CONFIG.getLong(ConfigurationKeys.STORE_DB_MAX_WAIT, DEFAULT_DB_MAX_WAIT);
|
||||
}
|
||||
|
||||
protected ClassLoader getDriverClassLoader() {
|
||||
return MYSQL_DRIVER_LOADERS.getOrDefault(getDriverClassName(), ClassLoader.getSystemClassLoader());
|
||||
return MYSQL_DRIVER_LOADERS.getOrDefault(
|
||||
getDriverClassName(), this.getClass().getClassLoader());
|
||||
}
|
||||
|
||||
private static Map<String, ClassLoader> createMysqlDriverClassLoaders() {
|
||||
Map<String, ClassLoader> loaders = new HashMap<>();
|
||||
String cp = System.getProperty("java.class.path");
|
||||
String cp = System.getProperty("loader.path");
|
||||
if (cp == null) {
|
||||
cp = System.getProperty("java.class.path");
|
||||
}
|
||||
if (cp == null || cp.isEmpty()) {
|
||||
return loaders;
|
||||
}
|
||||
@@ -178,7 +198,7 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
}
|
||||
try {
|
||||
URL url = file.toURI().toURL();
|
||||
ClassLoader loader = new URLClassLoader(new URL[]{url}, ClassLoader.getSystemClassLoader());
|
||||
ClassLoader loader = new URLClassLoader(new URL[] {url}, ClassLoader.getSystemClassLoader());
|
||||
try {
|
||||
loader.loadClass(MYSQL8_DRIVER_CLASS_NAME);
|
||||
loaders.putIfAbsent(MYSQL8_DRIVER_CLASS_NAME, loader);
|
||||
@@ -279,5 +299,4 @@ public abstract class AbstractDataSourceProvider implements DataSourceProvider,
|
||||
protected String getPublicKey() {
|
||||
return CONFIG.getConfig(ConfigurationKeys.STORE_PUBLIC_KEY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,11 +19,6 @@ logging:
|
||||
# bootstrap-servers: 127.0.0.1:9092
|
||||
# topic: logback_to_logstash
|
||||
|
||||
console:
|
||||
user:
|
||||
username: seata
|
||||
password: seata
|
||||
|
||||
seata:
|
||||
config:
|
||||
# support: nacos 、 consul 、 apollo 、 zk 、 etcd3
|
||||
@@ -52,9 +47,3 @@ seata:
|
||||
##if use MSE Nacos with auth, mutex with username/password attribute
|
||||
#access-key: ""
|
||||
#secret-key: ""
|
||||
security:
|
||||
secretKey: rE7bYayhpvduYwCxuhckybEPDXyna6xwm5m7MZjtjrdXjVxAbXAMccXHyaJvB346
|
||||
tokenValidityInMilliseconds: 1800000
|
||||
csrf-ignore-urls: /metadata/v1/**
|
||||
ignore:
|
||||
urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error,/vgroup/v1/**
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -266,6 +266,26 @@ seata:
|
||||
application-id: ${spring.application.name}
|
||||
# Seata 事务组编号,用于 TC 集群名
|
||||
tx-service-group: ${spring.application.name}-group
|
||||
config:
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.server-addr}
|
||||
group: ${spring.cloud.nacos.config.group}
|
||||
namespace: ${spring.profiles.active}
|
||||
username: ${spring.cloud.nacos.username}
|
||||
password: ${spring.cloud.nacos.password}
|
||||
data-id: seata-server.properties
|
||||
registry:
|
||||
type: nacos
|
||||
nacos:
|
||||
application: ruoyi-seata-server
|
||||
server-addr: ${spring.cloud.nacos.server-addr}
|
||||
group: ${spring.cloud.nacos.discovery.group}
|
||||
username: ${spring.cloud.nacos.username}
|
||||
password: ${spring.cloud.nacos.password}
|
||||
namespace: ${spring.profiles.active}
|
||||
# 关闭自动代理
|
||||
enable-auto-data-source-proxy: false
|
||||
|
||||
# 多租户配置
|
||||
tenant:
|
||||
|
Reference in New Issue
Block a user