RuoYi
2022-03-30 7c3425ee9bf49335477a005dae1d7143685a5463
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
    }
}