You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "fu-cheng1 (via GitHub)" <gi...@apache.org> on 2025/07/31 09:34:07 UTC
[PR] Enhance Network Interface Configuration via Spring Environment [dubbo]
fu-cheng1 opened a new pull request, #15601:
URL: https://github.com/apache/dubbo/pull/15601
#6588
This change allows the dubbo.network.interface.preferred configuration to be set via Spring configuration files, rather than requiring it to be specified as a system property at startup.
Currently, Dubbo determines the preferred network interface too early in the application lifecycle, due to logging mechanisms like FailsafeLogger that trigger host resolution (via NetUtils) before Spring configuration is available.
To address this, a new listener DubboNetInterfaceConfigApplicationListener is introduced. It listens for the ApplicationPreparedEvent, reads the network interface configuration from the Spring Environment, and sets it into system properties if not already configured. The listener is intentionally not registered as an ApplicationContextInitializer to avoid running before PropertySourceBootstrapConfiguration in Spring Cloud environments. Additionally, since the current Dubbo version does not yet depend on a Spring Boot version that supports ApplicationContextInitializedEvent, the ApplicationPreparedEvent is chosen as a safe extension point.
This change improves flexibility and integration with Spring-based configuration management, especially in Spring Cloud environments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Enhance Network Interface Configuration via Spring Environment [dubbo]
Posted by "heliang666s (via GitHub)" <gi...@apache.org>.
heliang666s commented on PR #15601:
URL: https://github.com/apache/dubbo/pull/15601#issuecomment-3139229652
please run `mvn spotless:apply`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Enhance Network Interface Configuration via Spring Environment [dubbo]
Posted by "heliang666s (via GitHub)" <gi...@apache.org>.
heliang666s commented on code in PR #15601:
URL: https://github.com/apache/dubbo/pull/15601#discussion_r2244879790
##########
dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/context/DubboNetInterfaceConfigApplicationContextInitializerTest.java:
##########
@@ -0,0 +1,59 @@
+package org.apache.dubbo.spring.boot.context;
+
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.spring.boot.context.event.DubboNetInterfaceConfigApplicationListener;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.MutablePropertySources;
+
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_NETWORK_IGNORED_INTERFACE;
+import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PREFERRED_NETWORK_INTERFACE;
+
+/**
+ * @since 3.2
Review Comment:
if you want to develop or enhance sone features, please merge into 3.3 branch, 3.2 branch is only bugfix now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Enhance Network Interface Configuration via Spring Environment [dubbo]
Posted by "fu-cheng1 (via GitHub)" <gi...@apache.org>.
fu-cheng1 closed pull request #15601: Enhance Network Interface Configuration via Spring Environment
URL: https://github.com/apache/dubbo/pull/15601
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org