From dbffba5c5de26fa6465434a7a09cca5acf54399d Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Wed, 2 Nov 2022 10:28:20 +0100 Subject: [PATCH] Remove Consul hints since new GraalVM reachability metadata has been released. --- .../cloud/consul/ConsulAutoConfiguration.java | 136 ------------------ .../resources/META-INF/spring/aot.factories | 2 - 2 files changed, 138 deletions(-) delete mode 100644 spring-cloud-consul-core/src/main/resources/META-INF/spring/aot.factories diff --git a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulAutoConfiguration.java b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulAutoConfiguration.java index 3af89bc2..3717cbc7 100644 --- a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulAutoConfiguration.java +++ b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulAutoConfiguration.java @@ -18,51 +18,12 @@ package org.springframework.cloud.consul; import java.util.function.Supplier; -import com.ecwid.consul.transport.AbstractHttpTransport; -import com.ecwid.consul.transport.HttpResponse; import com.ecwid.consul.transport.TLSConfig; import com.ecwid.consul.v1.ConsulClient; import com.ecwid.consul.v1.ConsulRawClient; import com.ecwid.consul.v1.ConsulRawClient.Builder; -import com.ecwid.consul.v1.QueryParams; -import com.ecwid.consul.v1.Response; -import com.ecwid.consul.v1.acl.AclClient; -import com.ecwid.consul.v1.acl.model.NewAcl; -import com.ecwid.consul.v1.acl.model.UpdateAcl; -import com.ecwid.consul.v1.agent.AgentClient; -import com.ecwid.consul.v1.agent.AgentConsulClient; -import com.ecwid.consul.v1.agent.model.Check; -import com.ecwid.consul.v1.agent.model.NewCheck; -import com.ecwid.consul.v1.agent.model.NewService; -import com.ecwid.consul.v1.catalog.CatalogClient; -import com.ecwid.consul.v1.catalog.CatalogConsulClient; -import com.ecwid.consul.v1.catalog.CatalogNodesRequest; -import com.ecwid.consul.v1.catalog.CatalogServiceRequest; -import com.ecwid.consul.v1.catalog.model.CatalogDeregistration; -import com.ecwid.consul.v1.catalog.model.CatalogRegistration; -import com.ecwid.consul.v1.coordinate.CoordinateClient; -import com.ecwid.consul.v1.event.EventClient; -import com.ecwid.consul.v1.event.EventListRequest; -import com.ecwid.consul.v1.event.model.Event; -import com.ecwid.consul.v1.event.model.EventParams; -import com.ecwid.consul.v1.health.HealthChecksForServiceRequest; -import com.ecwid.consul.v1.health.HealthClient; -import com.ecwid.consul.v1.health.HealthServicesRequest; -import com.ecwid.consul.v1.health.model.HealthService; -import com.ecwid.consul.v1.kv.KeyValueClient; -import com.ecwid.consul.v1.kv.model.GetBinaryValue; -import com.ecwid.consul.v1.kv.model.GetValue; -import com.ecwid.consul.v1.kv.model.PutParams; -import com.ecwid.consul.v1.query.QueryClient; -import com.ecwid.consul.v1.session.SessionClient; -import com.ecwid.consul.v1.session.model.Session; -import com.ecwid.consul.v1.status.StatusClient; import org.aspectj.lang.annotation.Aspect; -import org.springframework.aot.hint.MemberCategory; -import org.springframework.aot.hint.RuntimeHints; -import org.springframework.aot.hint.RuntimeHintsRegistrar; -import org.springframework.aot.hint.TypeReference; import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint; import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.endpoint.annotation.Endpoint; @@ -78,7 +39,6 @@ import org.springframework.retry.annotation.EnableRetry; import org.springframework.retry.annotation.Retryable; import org.springframework.retry.interceptor.RetryInterceptorBuilder; import org.springframework.retry.interceptor.RetryOperationsInterceptor; -import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; /** @@ -178,99 +138,3 @@ public class ConsulAutoConfiguration { } } - -// TODO: remove hints after merging GraalVM metadata PR -class ConsulHints implements RuntimeHintsRegistrar { - - @Override - public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - if (!ClassUtils.isPresent("com.ecwid.consul.v1.ConsulClient", classLoader)) { - return; - } - hints.reflection().registerType(TypeReference.of(NewService.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(NewAcl.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(UpdateAcl.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(NewCheck.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(CatalogDeregistration.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(CatalogRegistration.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(CatalogRegistration.Service.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(QueryParams.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(EventParams.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(EventListRequest.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(CatalogNodesRequest.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(CatalogServiceRequest.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(HealthChecksForServiceRequest.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(HealthServicesRequest.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(PutParams.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(AbstractHttpTransport.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(ConsulClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(ConsulRawClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(AgentConsulClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(CatalogConsulClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(AclClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(AgentClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(CatalogClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(CoordinateClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(EventClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(HealthClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(KeyValueClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(QueryClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(SessionClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(StatusClient.class), - hint -> hint.withMembers(MemberCategory.INTROSPECT_DECLARED_METHODS)); - hints.reflection().registerType(TypeReference.of(HttpResponse.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(HealthService.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(HealthService.Node.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(HealthService.Service.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(Response.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(Session.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(GetBinaryValue.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(GetValue.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(Check.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(Check.CheckStatus.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(com.ecwid.consul.v1.health.model.Check.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - hints.reflection().registerType(TypeReference.of(Event.class), - hint -> hint.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.DECLARED_FIELDS)); - } - -} diff --git a/spring-cloud-consul-core/src/main/resources/META-INF/spring/aot.factories b/spring-cloud-consul-core/src/main/resources/META-INF/spring/aot.factories deleted file mode 100644 index e2e59245..00000000 --- a/spring-cloud-consul-core/src/main/resources/META-INF/spring/aot.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.aot.hint.RuntimeHintsRegistrar=\ -org.springframework.cloud.consul.ConsulHints