Repository navigation
Make InetUtils optional for the simple discovery client - #1758
Akhil-1527 wants to merge 1 commit into
Conversation
Setting spring.cloud.util.enabled=false stopped the application from starting, because the blocking and reactive simple discovery client configurations required an InetUtils bean. They now use it only when it is available, to set the local instance host. Fixes spring-cloudgh-631 Signed-off-by: Akhil CH <200716675+Akhil-1527@users.noreply.github.com>
kdelay
left a comment
There was a problem hiding this comment.
Looks right, and the new test passes locally. One note: the host assertion holds only because InetUtils is absent. Same test without spring.cloud.util.enabled=false (keeping local.host=myhost):
expected: "myhost"
but was: "10.10.11.209"
onApplicationEvent(WebServerInitializedEvent) re-sets the host whenever InetUtils exists, so a configured local.host is kept only when util is disabled. That predates this PR, so maybe a separate issue.
|
Thanks for running it. You're right, that overwrite is already on 5.0.x: I'd keep this PR to gh-631. The fix would be a small check in both |
Setting
spring.cloud.util.enabled=falsestops the application from starting. The blocking and reactive simple discovery client configurations takeInetUtilsin their constructors, and that bean only exists while the util auto-configuration is enabled.Both configurations now take an
ObjectProvider<InetUtils>and use it only when the bean is available, to set the local instance host. Without it, the local instance keeps the host bound fromspring.cloud.discovery.client.simple.local.hostand still gets the web server port.UtilDisabledSimpleDiscoveryPropertiesAutoConfigurationTestsstarts a web application with util disabled and checks the blocking and reactive local instances. It fails without the change.Fixes #631