From 5cb8c3c35407c82b14895b486ec1fba33f2c785c Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Fri, 19 Mar 2021 11:38:41 +0100 Subject: [PATCH] Initialize classes using j.u.Random at runtime in kafka-client --- .../kafka/client/deployment/KafkaProcessor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 77cdf9fbd5ad6..128cc21e640e4 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -62,6 +62,7 @@ import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem; +import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.pkg.NativeConfig; import io.quarkus.kafka.client.runtime.KafkaBindingConverter; @@ -395,6 +396,15 @@ UnremovableBeanBuildItem ensureJsonParserAvailable() { "javax.json.bind.Jsonb"); } + @BuildStep + public void registerRuntimeInitializedClasses(BuildProducer producer) { + // Classes using java.util.Random, which need to be runtime initialized + producer.produce( + new RuntimeInitializedClassBuildItem("org.apache.kafka.common.security.authenticator.SaslClientAuthenticator")); + producer.produce(new RuntimeInitializedClassBuildItem( + "org.apache.kafka.common.security.oauthbearer.internals.expiring.ExpiringCredentialRefreshingLogin")); + } + @BuildStep void registerServiceBinding(Capabilities capabilities, BuildProducer serviceProvider) {