Skip to content

Commit 4cac9d7

Browse files
committed
Ensure actuator works without Spring MVC
Update MetricFilterAutoConfiguration to ensure that it is only applied if Spring MVC is on the classpath. Fixes gh-2542
1 parent 8e594c7 commit 4cac9d7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
@Configuration
5454
@ConditionalOnBean({ CounterService.class, GaugeService.class })
5555
@ConditionalOnClass({ Servlet.class, ServletRegistration.class,
56-
OncePerRequestFilter.class })
56+
OncePerRequestFilter.class, HandlerMapping.class })
5757
@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class)
5858
public class MetricFilterAutoConfiguration {
5959

spring-boot-samples/spring-boot-sample-jersey/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<groupId>org.springframework.boot</groupId>
2626
<artifactId>spring-boot-starter-jersey</artifactId>
2727
</dependency>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-starter-actuator</artifactId>
31+
</dependency>
2832
<dependency>
2933
<groupId>org.springframework.boot</groupId>
3034
<artifactId>spring-boot-starter-test</artifactId>

0 commit comments

Comments
 (0)