add 整合 seata 1.4.2 对接 nacos 注册中心 配置中心
parent
d491e8d2fb
commit
0c2efd36cf
@ -0,0 +1,47 @@
|
||||
service.vgroupMapping.ruoyi-auth-group=default
|
||||
service.vgroupMapping.ruoyi-system-group=default
|
||||
service.vgroupMapping.ruoyi-file-group=default
|
||||
service.enableDegrade=false
|
||||
service.disableGlobalTransaction=false
|
||||
store.mode=db
|
||||
store.publicKey=
|
||||
store.db.datasource=druid
|
||||
store.db.dbType=mysql
|
||||
store.db.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
store.db.url=jdbc:mysql://172.30.0.36:3306/ry-seata?useUnicode=true&rewriteBatchedStatements=true
|
||||
store.db.user=root
|
||||
store.db.password=root
|
||||
store.db.minConn=5
|
||||
store.db.maxConn=30
|
||||
store.db.globalTable=global_table
|
||||
store.db.branchTable=branch_table
|
||||
store.db.distributedLockTable=distributed_lock
|
||||
store.db.queryLimit=100
|
||||
store.db.lockTable=lock_table
|
||||
store.db.maxWait=5000
|
||||
server.recovery.committingRetryPeriod=1000
|
||||
server.recovery.asynCommittingRetryPeriod=1000
|
||||
server.recovery.rollbackingRetryPeriod=1000
|
||||
server.recovery.timeoutRetryPeriod=1000
|
||||
server.maxCommitRetryTimeout=-1
|
||||
server.maxRollbackRetryTimeout=-1
|
||||
server.rollbackRetryTimeoutUnlockEnable=false
|
||||
server.distributedLockExpireTime=10000
|
||||
client.undo.dataValidation=true
|
||||
client.undo.logSerialization=kryo
|
||||
client.undo.onlyCareUpdateColumns=true
|
||||
server.undo.logSaveDays=7
|
||||
server.undo.logDeletePeriod=86400000
|
||||
client.undo.logTable=undo_log
|
||||
client.undo.compress.enable=true
|
||||
client.undo.compress.type=zip
|
||||
client.undo.compress.threshold=64k
|
||||
log.exceptionRate=100
|
||||
transport.serialization=seata
|
||||
transport.compressor=none
|
||||
metrics.enabled=false
|
||||
metrics.registryType=compact
|
||||
metrics.exporterList=prometheus
|
||||
metrics.exporterPrometheusPort=9898
|
||||
tcc.fence.logTableName=tcc_fence_log
|
||||
tcc.fence.cleanPeriod=1h
|
@ -0,0 +1,28 @@
|
||||
registry {
|
||||
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
|
||||
type = "nacos"
|
||||
|
||||
nacos {
|
||||
application = "seata-server"
|
||||
serverAddr = "172.30.0.40:8848"
|
||||
group = "DEFAULT_GROUP"
|
||||
namespace = "dev"
|
||||
cluster = "default"
|
||||
username = ""
|
||||
password = ""
|
||||
}
|
||||
}
|
||||
|
||||
config {
|
||||
# file、nacos 、apollo、zk、consul、etcd3
|
||||
type = "nacos"
|
||||
|
||||
nacos {
|
||||
serverAddr = "172.30.0.40:8848"
|
||||
group = "DEFAULT_GROUP"
|
||||
namespace = "dev"
|
||||
username = ""
|
||||
password = ""
|
||||
dataId = "seata-server.properties"
|
||||
}
|
||||
}
|
@ -1,41 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>0.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-datasource多数据源
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Dynamic DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>${dynamic-ds.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Seata -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>0.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-datasource多数据源
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Dynamic DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>${dynamic-ds.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.ruoyi.common.datasource.env;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.env.EnvironmentPostProcessor;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
|
||||
/**
|
||||
* seata 在 springboot 2.6.x 存在循环引用问题的处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ApplicationSeataInitializer implements EnvironmentPostProcessor, Ordered
|
||||
{
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application)
|
||||
{
|
||||
System.setProperty("spring.main.allow-circular-references", "true");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder()
|
||||
{
|
||||
return Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
}
|
@ -1,2 +1 @@
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
com.ruoyi.common.datasource.env.ApplicationSeataInitializer
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=
|
||||
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>0.3.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-common-seata</artifactId>
|
||||
|
||||
<description>
|
||||
ruoyi-common-seata 分布式事务
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot Seata -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 用于修复 seata 序列化问题 -->
|
||||
<dependency>
|
||||
<groupId>com.esotericsoftware</groupId>
|
||||
<artifactId>kryo</artifactId>
|
||||
<version>4.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.javakaffee</groupId>
|
||||
<artifactId>kryo-serializers</artifactId>
|
||||
<version>0.45</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
|
@ -1,19 +1,19 @@
|
||||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysFileService {
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
public String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
package com.ruoyi.file.service;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysFileService {
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
*/
|
||||
String uploadFile(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
Loading…
Reference in New Issue