🐛 Fixing a bug. 分布式事务兼容 SpringBoot 2.6

This commit is contained in:
qraddx committed 2022-02-17 15:20:45 +08:00
1 parent ccb5132e40
commit 97ed79b7f6
6 files changed
+42 -1

No files matched your search

@@ -0,0 +1,26 @@
package com.pig4cloud.pigx.common.transaction.tx.init;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* @author lengleng
* @date 22022-02-17
* <p>
* 通过环境变量的形式注入 允许循环依赖
*/
public class ApplicationTxInitializer 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 +1,3 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.pig4cloud.pigx.common.transaction.TransactionConfiguration
org.springframework.boot.env.EnvironmentPostProcessor=\
com.pig4cloud.pigx.common.transaction.tx.init.ApplicationTxInitializer
+5
View File
@@ -33,6 +33,11 @@
<description>pigx 通用用户权限管理系统业务处理模块</description>
<dependencies>
<!--工具类核心包-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common-transaction</artifactId>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
@@ -60,7 +60,7 @@
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="debug">
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="debug"/>
</root>
+5
View File
@@ -141,6 +141,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<!--工具类核心包-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-common-transaction</artifactId>
</dependency>
</dependencies>
<build>
@@ -0,0 +1,3 @@
spring:
main:
allow-circular-references: true