From 1afa479049bef2d960bee3dc79bffc1cddd6e4d0 Mon Sep 17 00:00:00 2001 From: Croway Date: Tue, 14 Jul 2026 10:54:26 +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 bd71893893cc..ee71f4cb8556 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 0a2022408f84..8d2f4e5d32dd 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 @@ -47,7 +47,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 { // TODO reintroduce once spring-boot-starter-undertow will be available @@ -78,7 +82,10 @@ static class UndertowAccessLogCustomizerConfiguration { * 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 {