Fix SlackConfig class for native builds

Fixes #2489
diff --git a/extensions/slack/runtime/pom.xml b/extensions/slack/runtime/pom.xml
index 6b4e8e4..04d2412 100644
--- a/extensions/slack/runtime/pom.xml
+++ b/extensions/slack/runtime/pom.xml
@@ -55,6 +55,11 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-slack</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.graalvm.nativeimage</groupId>
+            <artifactId>svm</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java b/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java
new file mode 100644
index 0000000..1038f9a
--- /dev/null
+++ b/extensions/slack/runtime/src/main/java/org/apache/camel/quarkus/component/slack/graal/SlackSubstitutions.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.slack.graal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.RecomputeFieldValue;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import com.oracle.svm.core.annotate.TargetElement;
+import com.slack.api.SlackConfig;
+import com.slack.api.audit.AuditConfig;
+import com.slack.api.methods.MethodsConfig;
+import com.slack.api.rate_limits.metrics.MetricsDatastore;
+import com.slack.api.scim.SCIMConfig;
+import com.slack.api.util.http.listener.DetailedLoggingListener;
+import com.slack.api.util.http.listener.HttpResponseListener;
+import com.slack.api.util.http.listener.ResponsePrettyPrintingListener;
+
+import static com.oracle.svm.core.annotate.RecomputeFieldValue.Kind.Reset;
+
+/**
+ * Avoids original impl of eagerly initialized static fields which leads to a
+ * started thread via com.slack.api.rate_limits.metrics.impl.BaseMemoryMetricsDatastore.MaintenanceJob
+ */
+final class SlackSubstitutions {
+}
+
+@TargetClass(SlackConfig.class)
+final class SlackConfigSubstitutions {
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    private AuditConfig auditConfig = new AuditConfig() {
+        void throwException() {
+            throw new UnsupportedOperationException("This config is immutable");
+        }
+
+        @Override
+        public void setStatsEnabled(boolean statsEnabled) {
+            throwException();
+        }
+
+        @Override
+        public void setExecutorName(String executorName) {
+            throwException();
+        }
+
+        @Override
+        public void setMaxIdleMills(int maxIdleMills) {
+            throwException();
+        }
+
+        @Override
+        public void setDefaultThreadPoolSize(int defaultThreadPoolSize) {
+            throwException();
+        }
+
+        @Override
+        public void setMetricsDatastore(MetricsDatastore metricsDatastore) {
+            throwException();
+        }
+
+        @Override
+        public void setCustomThreadPoolSizes(Map<String, Integer> customThreadPoolSizes) {
+            throwException();
+        }
+    };
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    private MethodsConfig methodsConfig = new MethodsConfig() {
+        void throwException() {
+            throw new UnsupportedOperationException("This config is immutable");
+        }
+
+        @Override
+        public void setStatsEnabled(boolean statsEnabled) {
+            throwException();
+        }
+
+        @Override
+        public void setExecutorName(String executorName) {
+            throwException();
+        }
+
+        @Override
+        public void setMaxIdleMills(int maxIdleMills) {
+            throwException();
+        }
+
+        @Override
+        public void setDefaultThreadPoolSize(int defaultThreadPoolSize) {
+            throwException();
+        }
+
+        @Override
+        public void setMetricsDatastore(MetricsDatastore metricsDatastore) {
+            throwException();
+        }
+
+        @Override
+        public void setCustomThreadPoolSizes(Map<String, Integer> customThreadPoolSizes) {
+            throwException();
+        }
+    };
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    private SCIMConfig sCIMConfig = new SCIMConfig() {
+        void throwException() {
+            throw new UnsupportedOperationException("This config is immutable");
+        }
+
+        @Override
+        public void setStatsEnabled(boolean statsEnabled) {
+            throwException();
+        }
+
+        @Override
+        public void setExecutorName(String executorName) {
+            throwException();
+        }
+
+        @Override
+        public void setMaxIdleMills(int maxIdleMills) {
+            throwException();
+        }
+
+        @Override
+        public void setDefaultThreadPoolSize(int defaultThreadPoolSize) {
+            throwException();
+        }
+
+        @Override
+        public void setMetricsDatastore(MetricsDatastore metricsDatastore) {
+            throwException();
+        }
+
+        @Override
+        public void setCustomThreadPoolSizes(Map<String, Integer> customThreadPoolSizes) {
+            throwException();
+        }
+    };
+
+    @Alias
+    private List<HttpResponseListener> httpClientResponseHandlers = new ArrayList();
+
+    @Substitute
+    @TargetElement(name = "SlackConfig")
+    public SlackConfigSubstitutions() {
+        httpClientResponseHandlers.add(new DetailedLoggingListener());
+        httpClientResponseHandlers.add(new ResponsePrettyPrintingListener());
+    }
+}
+
+@TargetClass(AuditConfig.class)
+final class AuditConfigSubstitutions {
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    public static AuditConfig DEFAULT_SINGLETON = null;
+}
+
+@TargetClass(MethodsConfig.class)
+final class MethodsConfigSubstitutions {
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    public static MethodsConfig DEFAULT_SINGLETON = null;
+}
+
+@TargetClass(SCIMConfig.class)
+final class SCIMConfigSubstitutions {
+
+    @Alias
+    @RecomputeFieldValue(kind = Reset)
+    public static SCIMConfig DEFAULT_SINGLETON = null;
+}
diff --git a/integration-tests/slack/pom.xml b/integration-tests/slack/pom.xml
index 1e4682c..a9457a4 100644
--- a/integration-tests/slack/pom.xml
+++ b/integration-tests/slack/pom.xml
@@ -30,13 +30,10 @@
     <description>Integration tests for Camel Quarkus Slack extension</description>
 
     <dependencies>
+        <!-- Mongo dependency exists as a test for https://github.com/apache/camel-quarkus/issues/2489 -->
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-netty-http</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-rest</artifactId>
+            <artifactId>camel-quarkus-mongodb</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
@@ -66,20 +63,7 @@
         <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-netty-http-deployment</artifactId>
-            <version>${project.version}</version>
-            <type>pom</type>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>*</groupId>
-                    <artifactId>*</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-rest-deployment</artifactId>
+            <artifactId>camel-quarkus-mongodb-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
             <scope>test</scope>
diff --git a/integration-tests/slack/src/main/resources/application.properties b/integration-tests/slack/src/main/resources/application.properties
new file mode 100644
index 0000000..88f15d1
--- /dev/null
+++ b/integration-tests/slack/src/main/resources/application.properties
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+quarkus.log.category."org.mongodb".level = OFF