Browse Source

Rename HttpServiceClientRegistrarSupport

to AbstractClientHttpServiceRegistrar since it is a registrar and
an extension of Abstract[HttpServiceRegistrar]. Also, a more
friendly name for use in application configuration.

See gh-35244
pull/35266/head
rstoyanchev 6 months ago
parent
commit
c8b2a0f830
  1. 10
      spring-web/src/main/java/org/springframework/web/service/registry/AbstractClientHttpServiceRegistrar.java
  2. 7
      spring-web/src/main/java/org/springframework/web/service/registry/AbstractHttpServiceRegistrar.java
  3. 4
      spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceClient.java
  4. 2
      spring-web/src/main/java/org/springframework/web/service/registry/ImportHttpServiceRegistrar.java
  5. 6
      spring-web/src/main/java/org/springframework/web/service/registry/ImportHttpServices.java
  6. 6
      spring-web/src/test/java/org/springframework/web/service/registry/ClientHttpServiceRegistrarTests.java
  7. 6
      spring-web/src/test/java/org/springframework/web/service/registry/ImportHttpServiceRegistrarTests.java

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

@ -24,17 +24,19 @@ import org.springframework.core.annotation.MergedAnnotations; @@ -24,17 +24,19 @@ import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.core.type.AnnotationMetadata;
/**
* Base class for an {@link AbstractHttpServiceRegistrar} to detects and register
* {@link HttpServiceClient @HttpServiceClient} annotated interfaces.
* Base class for an HTTP Service registrar that detects
* {@link HttpServiceClient @HttpServiceClient} annotated interfaces and
* registers them.
*
* <p>Subclasses need to implement
* {@link #registerHttpServices(GroupRegistry, AnnotationMetadata)} and invoke
* {@link #findAndRegisterHttpServiceClients(GroupRegistry, List)}.
* {@link #findAndRegisterHttpServiceClients(GroupRegistry, List)} with the
* list of base packages to scan.
*
* @author Rossen Stoyanchev
* @since 7.0
*/
public abstract class HttpServiceClientRegistrarSupport extends AbstractHttpServiceRegistrar {
public abstract class AbstractClientHttpServiceRegistrar extends AbstractHttpServiceRegistrar {
/**
* Find all HTTP Services under the given base packages that also have an

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

@ -226,7 +226,8 @@ public abstract class AbstractHttpServiceRegistrar implements @@ -226,7 +226,8 @@ public abstract class AbstractHttpServiceRegistrar implements
protected interface GroupRegistry {
/**
* Perform HTTP Service registrations for the given group.
* Perform HTTP Service registrations for the given group, either
* creating the group if it does not exist, or updating the existing one.
*/
default GroupSpec forGroup(String name) {
return forGroup(name, HttpServiceGroup.ClientType.UNSPECIFIED);
@ -251,7 +252,7 @@ public abstract class AbstractHttpServiceRegistrar implements @@ -251,7 +252,7 @@ public abstract class AbstractHttpServiceRegistrar implements
interface GroupSpec {
/**
* Register HTTP Service types to create proxies for.
* Register HTTP Service types associated with this group.
*/
GroupSpec register(Class<?>... serviceTypes);
@ -265,7 +266,7 @@ public abstract class AbstractHttpServiceRegistrar implements @@ -265,7 +266,7 @@ public abstract class AbstractHttpServiceRegistrar implements
* interfaces with type or method {@link HttpExchange} annotations.
* <p>The performed scan, however, filters out any interfaces
* annotated with {@link HttpServiceClient} that are instead supported
* by {@link HttpServiceClientRegistrarSupport}.
* by {@link AbstractClientHttpServiceRegistrar}.
*/
GroupSpec detectInBasePackages(Class<?>... packageClasses);

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

@ -27,11 +27,11 @@ import org.springframework.core.annotation.AliasFor; @@ -27,11 +27,11 @@ import org.springframework.core.annotation.AliasFor;
/**
* Annotation to mark an HTTP Service interface as a candidate client proxy creation.
* Supported by extensions of {@link HttpServiceClientRegistrarSupport}.
* Supported through the import of an {@link AbstractClientHttpServiceRegistrar}.
*
* @author Rossen Stoyanchev
* @since 7.0
* @see HttpServiceClientRegistrarSupport
* @see AbstractClientHttpServiceRegistrar
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)

2
spring-web/src/main/java/org/springframework/web/service/registry/ImportHttpServicesRegistrar.java → spring-web/src/main/java/org/springframework/web/service/registry/ImportHttpServiceRegistrar.java

@ -29,7 +29,7 @@ import org.springframework.core.type.AnnotationMetadata; @@ -29,7 +29,7 @@ import org.springframework.core.type.AnnotationMetadata;
* @author Olga Maciaszek-Sharma
* @since 7.0
*/
class ImportHttpServicesRegistrar extends AbstractHttpServiceRegistrar {
class ImportHttpServiceRegistrar extends AbstractHttpServiceRegistrar {
@Override
protected void registerHttpServices(GroupRegistry registry, AnnotationMetadata metadata) {

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

@ -53,7 +53,7 @@ import org.springframework.web.service.annotation.HttpExchange; @@ -53,7 +53,7 @@ import org.springframework.web.service.annotation.HttpExchange;
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(ImportHttpServices.Container.class)
@Import(ImportHttpServicesRegistrar.class)
@Import(ImportHttpServiceRegistrar.class)
public @interface ImportHttpServices {
/**
@ -80,7 +80,7 @@ public @interface ImportHttpServices { @@ -80,7 +80,7 @@ public @interface ImportHttpServices {
* for interfaces with type or method {@link HttpExchange} annotations.
* <p>The performed scan, however, filters out interfaces annotated with
* {@link HttpServiceClient} that are instead supported by
* {@link HttpServiceClientRegistrarSupport}.
* {@link AbstractClientHttpServiceRegistrar}.
*/
Class<?>[] basePackageClasses() default {};
@ -107,7 +107,7 @@ public @interface ImportHttpServices { @@ -107,7 +107,7 @@ public @interface ImportHttpServices {
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(ImportHttpServicesRegistrar.class)
@Import(ImportHttpServiceRegistrar.class)
@interface Container {
ImportHttpServices[] value();

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

@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Unit tests for {@link HttpServiceClientRegistrarSupport}.
* Unit tests for {@link AbstractClientHttpServiceRegistrar}.
* @author Rossen Stoyanchev
*/
public class HttpServiceClientRegistrarSupportTests {
public class ClientHttpServiceRegistrarTests {
private final TestGroupRegistry groupRegistry = new TestGroupRegistry();
@ -47,7 +47,7 @@ public class HttpServiceClientRegistrarSupportTests { @@ -47,7 +47,7 @@ public class HttpServiceClientRegistrarSupportTests {
List<String> basePackages = List.of(
BasicClient.class.getPackageName(), EchoClientA.class.getPackageName());
HttpServiceClientRegistrarSupport registrar = new HttpServiceClientRegistrarSupport() {
AbstractClientHttpServiceRegistrar registrar = new AbstractClientHttpServiceRegistrar() {
@Override
protected void registerHttpServices(GroupRegistry registry, AnnotationMetadata importingClassMetadata) {

6
spring-web/src/test/java/org/springframework/web/service/registry/ImportHttpServicesRegistrarTests.java → spring-web/src/test/java/org/springframework/web/service/registry/ImportHttpServiceRegistrarTests.java

@ -39,12 +39,12 @@ import org.springframework.web.service.registry.greeting.GreetingB; @@ -39,12 +39,12 @@ import org.springframework.web.service.registry.greeting.GreetingB;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ImportHttpServicesRegistrar}.
* Tests for {@link ImportHttpServiceRegistrar}.
*
* @author Rossen Stoyanchev
* @author Stephane Nicoll
*/
public class ImportHttpServicesRegistrarTests {
public class ImportHttpServiceRegistrarTests {
private static final String ECHO_GROUP = "echo";
@ -53,7 +53,7 @@ public class ImportHttpServicesRegistrarTests { @@ -53,7 +53,7 @@ public class ImportHttpServicesRegistrarTests {
private final TestGroupRegistry groupRegistry = new TestGroupRegistry();
private final ImportHttpServicesRegistrar registrar = new ImportHttpServicesRegistrar();
private final ImportHttpServiceRegistrar registrar = new ImportHttpServiceRegistrar();
@Test
Loading…
Cancel
Save