From f184e23110a63bfa6ddd501e6aad8ac2bd11897c Mon Sep 17 00:00:00 2001 From: Croway Date: Tue, 14 Jul 2026 10:55:34 +0200 Subject: [PATCH] CAMEL-24057: check actually-used classes in @ConditionalOnClass for access log configurations --- .../customizer/UndertowAccessLogConfiguration.java | 6 +++++- .../accesslog/ManagementAccessLogConfiguration.java | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/customizer/UndertowAccessLogConfiguration.java b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/customizer/UndertowAccessLogConfiguration.java index 33f0bca01b9c..01070e8665a3 100644 --- a/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/customizer/UndertowAccessLogConfiguration.java +++ b/components-starter/camel-platform-http-starter/src/main/java/org/apache/camel/component/platform/http/springboot/customizer/UndertowAccessLogConfiguration.java @@ -35,7 +35,11 @@ */ @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(UndertowAccessLogProperties.class) -@ConditionalOnClass(name = "io.undertow.Undertow") +@ConditionalOnClass(name = { + "io.undertow.Undertow", + "io.undertow.server.handlers.accesslog.AccessLogHandler", + "io.undertow.server.handlers.accesslog.JBossLoggingAccessLogReceiver" +}) @ConditionalOnProperties( { @ConditionalOnProperty(name = "server.undertow.accesslog.enabled", havingValue = "false"), @ConditionalOnProperty(name = "camel.component.platform-http.server.undertow.accesslog.use-camel-logging", havingValue = "true"), diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/accesslog/ManagementAccessLogConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/accesslog/ManagementAccessLogConfiguration.java index dd3b9ee1702c..bca4ddeecb65 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/accesslog/ManagementAccessLogConfiguration.java +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/actuate/accesslog/ManagementAccessLogConfiguration.java @@ -48,7 +48,11 @@ public class ManagementAccessLogConfiguration { * Undertow-specific configuration. */ @Configuration(proxyBeanMethods = false) - @ConditionalOnClass(name = "io.undertow.Undertow") + @ConditionalOnClass(name = { + "io.undertow.Undertow", + "io.undertow.server.handlers.accesslog.AccessLogHandler", + "io.undertow.server.handlers.accesslog.JBossLoggingAccessLogReceiver" + }) static class UndertowAccessLogCustomizerConfiguration { /** @@ -78,7 +82,10 @@ public WebServerFactoryCustomizer managementAcc * Tomcat-specific configuration to disable access logging in the management context. */ @Configuration(proxyBeanMethods = false) - @ConditionalOnClass(name = "org.apache.catalina.startup.Tomcat") + @ConditionalOnClass(name = { + "org.apache.catalina.startup.Tomcat", + "org.apache.catalina.valves.AccessLogValve" + }) @ConditionalOnProperty(name = "management.server.accesslog.enabled", havingValue = "false") static class TomcatAccessLogCustomizerConfiguration {