From e90c8548a21644738d9195636d16037b048ba3e2 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 6 Oct 2014 11:21:26 +0100 Subject: [PATCH] Make MetricFilter auto-configuration conditional on OncePerRequestFilter In addition to requiring the Servlet API to be on the classpath, MetricFilter requires spring-web to also be on the classpath as it extends OncePerRequestFilter. This commit updates the auto-configuration for MetricFilter so that it will be disabled in the absence of a dependency on spring-web. Fixes gh-1664 --- .../actuate/autoconfigure/MetricFilterAutoConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java index 1934f79634..bda227592e 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java @@ -52,7 +52,8 @@ import org.springframework.web.util.UrlPathHelper; */ @Configuration @ConditionalOnBean({ CounterService.class, GaugeService.class }) -@ConditionalOnClass({ Servlet.class, ServletRegistration.class }) +@ConditionalOnClass({ Servlet.class, ServletRegistration.class, + OncePerRequestFilter.class }) @AutoConfigureAfter(MetricRepositoryAutoConfiguration.class) public class MetricFilterAutoConfiguration {