Skip to content

Commit 736383e

Browse files
committed
Remove HttpServiceClient annotation
Closes gh-35431
1 parent e93a6a7 commit 736383e

File tree

9 files changed

+1
-360
lines changed

9 files changed

+1
-360
lines changed

framework-docs/modules/ROOT/pages/integration/rest-clients.adoc

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,46 +1195,6 @@ One way to declare HTTP Service groups is via `@ImportHttpServices` annotations
11951195
<1> Manually list interfaces for group "echo"
11961196
<2> Detect interfaces for group "greeting" under a base package
11971197

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 interface EchoServiceA {
1205-
// ...
1206-
}
1207-
1208-
@HttpServiceClient("echo")
1209-
public interface 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-
12381198
It is also possible to declare groups programmatically by creating an HTTP Service
12391199
registrar and then importing it:
12401200

spring-web/src/main/java/org/springframework/web/service/registry/AbstractClientHttpServiceRegistrar.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

spring-web/src/main/java/org/springframework/web/service/registry/AbstractHttpServiceRegistrar.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private Object getProxyInstance(String groupName, String httpServiceType) {
211211
* @param basePackage the names of packages to look under
212212
* @return match bean definitions
213213
*/
214-
protected Stream<BeanDefinition> findHttpServices(String basePackage) {
214+
private Stream<BeanDefinition> findHttpServices(String basePackage) {
215215
if (this.scanner == null) {
216216
Assert.state(this.environment != null, "Environment has not been set");
217217
Assert.state(this.resourceLoader != null, "ResourceLoader has not been set");
@@ -267,9 +267,6 @@ interface GroupSpec {
267267
/**
268268
* Detect HTTP Service types in the given packages, looking for
269269
* interfaces with type or method {@link HttpExchange} annotations.
270-
* <p>The performed scan, however, filters out any interfaces
271-
* annotated with {@link HttpServiceClient} that are instead supported
272-
* by {@link AbstractClientHttpServiceRegistrar}.
273270
*/
274271
GroupSpec detectInBasePackages(Class<?>... packageClasses);
275272

@@ -326,19 +323,11 @@ public GroupRegistry.GroupSpec detectInBasePackages(String... packageNames) {
326323

327324
private void detectInBasePackage(String packageName) {
328325
findHttpServices(packageName)
329-
.filter(DefaultGroupSpec::isNotHttpServiceClientAnnotated)
330326
.map(BeanDefinition::getBeanClassName)
331327
.filter(Objects::nonNull)
332328
.forEach(this::registerServiceTypeName);
333329
}
334330

335-
private static boolean isNotHttpServiceClientAnnotated(BeanDefinition defintion) {
336-
if (defintion instanceof AnnotatedBeanDefinition abd) {
337-
return !abd.getMetadata().hasAnnotation(HttpServiceClient.class.getName());
338-
}
339-
return true;
340-
}
341-
342331
private void registerServiceTypeName(String httpServiceTypeName) {
343332
this.registration.httpServiceTypeNames().add(httpServiceTypeName);
344333
}

spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceClient.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

spring-web/src/main/java/org/springframework/web/service/registry/ImportHttpServices.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@
7878
/**
7979
* Detect HTTP Services in the packages of the specified classes, looking
8080
* for interfaces with type or method {@link HttpExchange} annotations.
81-
* <p>The performed scan, however, filters out interfaces annotated with
82-
* {@link HttpServiceClient} that are instead supported by
83-
* {@link AbstractClientHttpServiceRegistrar}.
8481
*/
8582
Class<?>[] basePackageClasses() default {};
8683

spring-web/src/test/java/org/springframework/web/service/registry/ClientHttpServiceRegistrarTests.java

Lines changed: 0 additions & 102 deletions
This file was deleted.

spring-web/src/test/java/org/springframework/web/service/registry/basic/BasicClient.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

spring-web/src/test/java/org/springframework/web/service/registry/echo/EchoClientA.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)