Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeignClientsRegistar fails when trying to parse unresolved property placeholders in JDK 20+ #1023

Closed
elkkhan opened this issue Apr 17, 2024 · 1 comment · May be fixed by #1022
Closed

FeignClientsRegistar fails when trying to parse unresolved property placeholders in JDK 20+ #1023

elkkhan opened this issue Apr 17, 2024 · 1 comment · May be fixed by #1022
Labels
duplicate This issue or pull request already exists

Comments

@elkkhan
Copy link

elkkhan commented Apr 17, 2024

Spring Cloud version: 2023.0.1 (affects up to the latest version)

FeignClientsRegistar seems to purposefully ignore unresolved URLs that are SpEL but doesn't do so for property placeholders like ${placeholder}.
For ignored SpEL strings, the input string is returned, but for placeholders, it tries to parse it into a URL object.
Up until JDK 20, this would be OK and would not fail - and unresolved placeholder URL would probably fail somewhere later down the flow. This is because the underlying implementation of the URL class doesn't actually try to parse the host until unless the URL.openConnection() is called, which is not called in this method.

Since JDK 20, this behaviour has changed and the underlying implementation of the URL class now parses the host eagerly without waiting for a URL.openConnection() call.

This was discovered when our tests that use @JsonTest started failing once we upgraded to JDK 20+

@elkkhan elkkhan changed the title FeignClientsRegistar fail when trying to unresolved property placeholders in JDK 20+ FeignClientsRegistar fails when trying to unresolved property placeholders in JDK 20+ Apr 17, 2024
@elkkhan elkkhan changed the title FeignClientsRegistar fails when trying to unresolved property placeholders in JDK 20+ FeignClientsRegistar fails when trying to parse unresolved property placeholders in JDK 20+ Apr 17, 2024
@spencergibb
Copy link
Member

Closing in favor of #1022, no need to open an issue and PR at the same time.

@spencergibb spencergibb added duplicate This issue or pull request already exists and removed waiting-for-triage labels Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants