fix 修复 本地设置环境变量被覆盖问题
parent
fdfc8a7cd0
commit
c889bdf0c6
|
|
@ -1,5 +1,6 @@
|
||||||
package org.dromara.common.dubbo.config;
|
package org.dromara.common.dubbo.config;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
|
|
@ -34,6 +35,10 @@ public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||||
|
String property = System.getProperty("DUBBO_IP_TO_REGISTRY");
|
||||||
|
if (StringUtils.isNotBlank(property)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 获取 InetUtils bean,用于获取 IP 地址
|
// 获取 InetUtils bean,用于获取 IP 地址
|
||||||
InetUtils inetUtils = beanFactory.getBean(InetUtils.class);
|
InetUtils inetUtils = beanFactory.getBean(InetUtils.class);
|
||||||
String ip = "127.0.0.1";
|
String ip = "127.0.0.1";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue