spring-cloud-openfeign
spring-cloud-openfeign copied to clipboard
Ignore unresolved property placeholders in `url`
fixes https://github.com/spring-cloud/spring-cloud-openfeign/issues/1023
FeignClientRegistar
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+