Repository: quarkusio/quarkus
Issue: com.amazonaws.xray.interceptors.TracingInterceptor Native Image Failure

**Describe the bug**
Fix from #12842 fails in native builds.

**Expected behavior**
Tracing Interceptor is Created in AWS SDK Clients

**Actual behavior**
```
Error: Classes that should be initialized at run time got initialized during image building:
 com.amazonaws.xray.interceptors.TracingInterceptor the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). io.quarkus.runner.ApplicationImpl caused initialization of this class with the following trace: 
        at com.amazonaws.xray.interceptors.TracingInterceptor.<clinit>(TracingInterceptor.java)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at io.smallrye.config.Converters.lambda$static$7c03a47f$1(Converters.java:109)
        at io.smallrye.config.Converters$EmptyValueConverter.convert(Converters.java:925)
        at io.smallrye.config.Converters$TrimmingConverter.convert(Converters.java:946)
        at io.smallrye.config.Converters$BuiltInConverter.convert(Converters.java:852)
        at io.smallrye.config.Converters$CollectionConverter.convert(Converters.java:683)
        at io.smallrye.config.Converters$CollectionConverter.convert(Converters.java:660)
        at io.smallrye.config.Converters$OptionalConverter.convert(Converters.java:770)
        at io.smallrye.config.Converters$OptionalConverter.convert(Converters.java:751)
        at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:161)
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$amazon$common$runtime$SdkBuildTimeConfig(Config.zig:34557)
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$amazon$s3$runtime$S3BuildTimeConfig(Config.zig:34692)
        at io.quarkus.runtime.generated.Config.<clinit>(Config.zig:920)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:72)


com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 com.amazonaws.xray.interceptors.TracingInterceptor the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). io.quarkus.runner.ApplicationImpl caused initialization of this class with the following trace: 
        at com.amazonaws.xray.interceptors.TracingInterceptor.<clinit>(TracingInterceptor.java)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at io.smallrye.config.Converters.lambda$static$7c03a47f$1(Converters.java:109)
        at io.smallrye.config.Converters$EmptyValueConverter.convert(Converters.java:925)
        at io.smallrye.config.Converters$TrimmingConverter.convert(Converters.java:946)
        at io.smallrye.config.Converters$BuiltInConverter.convert(Converters.java:852)
        at io.smallrye.config.Converters$CollectionConverter.convert(Converters.java:683)
        at io.smallrye.config.Converters$CollectionConverter.convert(Converters.java:660)
        at io.smallrye.config.Converters$OptionalConverter.convert(Converters.java:770)
        at io.smallrye.config.Converters$OptionalConverter.convert(Converters.java:751)
        at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:161)
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$amazon$common$runtime$SdkBuildTimeConfig(Config.zig:34557)
        at io.quarkus.runtime.generated.Config.initGroup$io$quarkus$amazon$s3$runtime$S3BuildTimeConfig(Config.zig:34692)
        at io.quarkus.runtime.generated.Config.<clinit>(Config.zig:920)
        at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:72)


        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:518)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:187)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:720)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:720)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:538)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
        at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
```


**To Reproduce**

See #12842

**Configuration**
```properties
quarkus.s3.interceptors=com.amazonaws.xray.interceptors.TracingInterceptor.

```


**Environment (please complete the following information):**
 - Output of `java -version`:  openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 25.252-b09-jvmci-20.1-b02, mixed mode)
                                                                                          
 - Quarkus version or git rev:  1.9.1.Final
 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): 3.6.3

**Additional context**
cc @marcinczeczko @gsmet


Changed files:
extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientRecorder.java
extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AmazonServicesClientsProcessor.java
extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/SdkBuildTimeConfig.java

diff --git a/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AmazonServicesClientsProcessor.java b/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AmazonServicesClientsProcessor.java
index cda8f72528e..197c7039094 100644
--- a/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AmazonServicesClientsProcessor.java
+++ b/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AmazonServicesClientsProcessor.java
@@ -69,8 +69,9 @@ void setup(CombinedIndexBuildItem combinedIndexBuildItem,
         for (AmazonClientBuildItem client : amazonClients) {
             SdkBuildTimeConfig clientSdkConfig = client.getBuildTimeSdkConfig();
             if (clientSdkConfig != null) {
-                clientSdkConfig.interceptors.orElse(Collections.emptyList()).forEach(interceptorClass -> {
-                    if (!knownInterceptorImpls.contains(interceptorClass.getName())) {
+                clientSdkConfig.interceptors.orElse(Collections.emptyList()).forEach(interceptorClassName -> {
+                    interceptorClassName = interceptorClassName.trim();
+                    if (!knownInterceptorImpls.contains(interceptorClassName)) {
                         throw new ConfigurationError(
                                 String.format(
                                         "quarkus.%s.interceptors (%s) - must list only existing implementations of software.amazon.awssdk.core.interceptor.ExecutionInterceptor",
diff --git a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientRecorder.java b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientRecorder.java
index f812009c3bd..9e225a4551b 100644
--- a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientRecorder.java
+++ b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientRecorder.java
@@ -72,18 +72,19 @@ public void initSdkClient(SdkClientBuilder builder, String extension, SdkConfig
         config.apiCallAttemptTimeout.ifPresent(overrides::apiCallAttemptTimeout);
 
         buildConfig.interceptors.orElse(Collections.emptyList()).stream()
+                .map(String::trim)
                 .map(this::createInterceptor)
                 .filter(Objects::nonNull)
                 .forEach(overrides::addExecutionInterceptor);
         builder.overrideConfiguration(overrides.build());
     }
 
-    private ExecutionInterceptor createInterceptor(Class<?> interceptorClass) {
+    private ExecutionInterceptor createInterceptor(String interceptorClassName) {
         try {
             return (ExecutionInterceptor) Class
-                    .forName(interceptorClass.getName(), false, Thread.currentThread().getContextClassLoader()).newInstance();
+                    .forName(interceptorClassName, false, Thread.currentThread().getContextClassLoader()).newInstance();
         } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
-            LOG.error("Unable to create interceptor", e);
+            LOG.error("Unable to create interceptor " + interceptorClassName, e);
             return null;
         }
     }
diff --git a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/SdkBuildTimeConfig.java b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/SdkBuildTimeConfig.java
index 364aab283b9..4f366aecff9 100644
--- a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/SdkBuildTimeConfig.java
+++ b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/SdkBuildTimeConfig.java
@@ -22,5 +22,5 @@ public class SdkBuildTimeConfig {
      * @see software.amazon.awssdk.core.interceptor.ExecutionInterceptor
      */
     @ConfigItem
-    public Optional<List<Class<?>>> interceptors;
+    public Optional<List<String>> interceptors; // cannot be classes as can be runtime initialized (e.g. XRay interceptor)
 }