From f94e8bd28797291ff2974a6de8c04858630323e5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 22 Feb 2016 17:29:37 +0000 Subject: [PATCH] Do not try to auto-configure Jolokia if Spring MVC is not on classpath The Jolokia auto-configuration requires ServletWrappingController from Spring MVC to be on the classpath. This commit updates the auto-configuration to make it conditional on the presence of this class. Closes gh-5153 --- .../boot/actuate/autoconfigure/JolokiaAutoConfiguration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java index 8b507a8838..e40e1a1f05 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java @@ -39,6 +39,7 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.core.type.AnnotatedTypeMetadata; +import org.springframework.web.servlet.mvc.ServletWrappingController; /** * {@link EnableAutoConfiguration Auto-configuration} for embedding Jolokia, a JMX-HTTP @@ -61,7 +62,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata; */ @Configuration @ConditionalOnWebApplication -@ConditionalOnClass({ AgentServlet.class }) +@ConditionalOnClass({ AgentServlet.class, ServletWrappingController.class }) @Conditional(JolokiaCondition.class) @AutoConfigureBefore(ManagementWebSecurityAutoConfiguration.class) @AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class)