@@ -72,7 +72,7 @@ private void processMethods(final Class<?> clazz, final Object bean) {
72
72
throw new BeanDefinitionStoreException (
73
73
"Method " + method + " doesn't have exactly one parameter." );
74
74
}
75
- for (Class <?> paramType : paramTypes ) {
75
+ for (Class <?> paramType : paramTypes ) {
76
76
if (!AbstractStub .class .isAssignableFrom (paramType )) {
77
77
throw new BeanInstantiationException (paramType , "Unsupported grpc stub or channel type" );
78
78
}
@@ -86,17 +86,24 @@ private void processMethods(final Class<?> clazz, final Object bean) {
86
86
87
87
protected <T extends AbstractStub <T >>
88
88
T processInjectionPoint (final Class <T > injectionType ,
89
- final GrpcClient annotation ) {
89
+ final GrpcClient annotation ) {
90
90
Environment environment = applicationContext .getEnvironment ();
91
91
final List <ClientInterceptor > interceptors = interceptorsFromAnnotation (annotation );
92
92
String address = annotation .value ();
93
- if (!StringUtils .hasText (address )) {
93
+ if (!StringUtils .hasText (address )) {
94
94
address = properties .getDefaultService ();
95
95
}
96
- try {
97
- URI uri = URI .create (address );
98
- }catch (Exception e ) {
99
- address = environment .getProperty (address );
96
+ if (address .startsWith ("${" ) && address .endsWith ("}" )) {
97
+ address = environment .getProperty (address .substring (2 , address .length () - 1 ));
98
+ } else {
99
+ try {
100
+ URI uri = URI .create (address );
101
+ if (!uri .isAbsolute ()) {
102
+ address = environment .getProperty (address );
103
+ }
104
+ } catch (Exception e ) {
105
+ address = environment .getProperty (address );
106
+ }
100
107
}
101
108
return grpcSubClientFactory .createStub (injectionType , address , interceptors .toArray (new ClientInterceptor []{}));
102
109
}
0 commit comments