@@ -1195,6 +1195,46 @@ One way to declare HTTP Service groups is via `@ImportHttpServices` annotations
1195
1195
<1> Manually list interfaces for group "echo"
1196
1196
<2> Detect interfaces for group "greeting" under a base package
1197
1197
1198
+ The above lets you declare HTTP Services and groups. As an alternative, you can also
1199
+ annotate HTTP interfaces as follows:
1200
+
1201
+ [source,java,indent=0,subs="verbatim,quotes"]
1202
+ ----
1203
+ @HttpServiceClient("echo")
1204
+ public class EchoServiceA {
1205
+ // ...
1206
+ }
1207
+
1208
+ @HttpServiceClient("echo")
1209
+ public class EchoServiceB {
1210
+ // ...
1211
+ }
1212
+ ----
1213
+
1214
+ The above requires a dedicated import registrar as follows:
1215
+
1216
+ [source,java,indent=0,subs="verbatim,quotes"]
1217
+ ----
1218
+ public class MyClientHttpServiceRegistrar implements AbstractClientHttpServiceRegistrar { // <1>
1219
+
1220
+ @Override
1221
+ protected void registerHttpServices(GroupRegistry registry, AnnotationMetadata metadata) {
1222
+ findAndRegisterHttpServiceClients(groupRegistry, List.of("org.example.echo")); // <2>
1223
+ }
1224
+ }
1225
+
1226
+ @Configuration
1227
+ @Import(MyClientHttpServiceRegistrar.class) // <3>
1228
+ public class ClientConfig {
1229
+ }
1230
+ ----
1231
+ <1> Extend dedicated `AbstractClientHttpServiceRegistrar`
1232
+ <2> Specify base packages where to find client interfaces
1233
+ <3> Import the registrar
1234
+
1235
+ TIP: `@HttpServiceClient` interfaces are excluded from `@ImportHttpServices` scans, so there
1236
+ is no overlap with scans for client interfaces when pointed at the same package.
1237
+
1198
1238
It is also possible to declare groups programmatically by creating an HTTP Service
1199
1239
registrar and then importing it:
1200
1240
0 commit comments