Skip to content

Commit 17256b3

Browse files
therepanicdsyer
authored andcommitted
Remove static:// prefix from VirtualTargets.DEFAULT
The static:// prefix is not a valid gRPC scheme and causes IllegalArgumentException when using @ImportGrpcClients without Spring Boot. Replace the prefix logic with a simple resolution of "default" to "localhost:9090". References: gh-401 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
1 parent c506f18 commit 17256b3

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

spring-grpc-core/src/main/java/org/springframework/grpc/client/VirtualTargets.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,13 @@
1616

1717
package org.springframework.grpc.client;
1818

19-
import java.util.regex.Pattern;
20-
2119
public interface VirtualTargets {
2220

23-
/** Regex to match the default authority pattern. */
24-
Pattern AUTHORITY_PATTERN = Pattern.compile("([^:]+)(?::(\\d+))?");
25-
26-
/** Default VirtualTargets instance. */
27-
VirtualTargets DEFAULT = path -> {
28-
if (AUTHORITY_PATTERN.matcher(path).matches()) {
29-
return "static://" + path;
30-
}
31-
return path;
32-
};
21+
/**
22+
* Default VirtualTargets instance that resolves the logical name "default" to
23+
* "localhost:9090" and returns all other targets as-is.
24+
*/
25+
VirtualTargets DEFAULT = path -> "default".equals(path) ? "localhost:9090" : path;
3326

3427
String getTarget(String path);
3528

0 commit comments

Comments
 (0)