diff --git a/src/main/java/org/springframework/metrics/boot/MetricsBoot1Configuration.java b/src/main/java/org/springframework/metrics/boot/MetricsBoot1Configuration.java index 9306ce5acd..0fdc3c4e31 100644 --- a/src/main/java/org/springframework/metrics/boot/MetricsBoot1Configuration.java +++ b/src/main/java/org/springframework/metrics/boot/MetricsBoot1Configuration.java @@ -31,6 +31,7 @@ * @author Jon Schneider */ @Configuration +// this class didn't exist until Spring 5 @ConditionalOnMissingClass("org.springframework.web.server.WebFilter") // TODO got to be a better way... @Import({ InstrumentRestTemplateConfiguration.class, @@ -53,7 +54,7 @@ static class WebMvcConfiguration {} * If AOP is not enabled, scheduled interception will not work. */ @Bean - @ConditionalOnClass({RestTemplate.class, JoinPoint.class}) + @ConditionalOnClass(name = {"org.springframework.web.client.RestTemplate", "org.aopalliance.intercept.JoinPoint"}) @ConditionalOnProperty(value = "spring.aop.enabled", havingValue = "true", matchIfMissing = true) public MetricsSchedulingAspect metricsSchedulingAspect(MeterRegistry registry) { return new MetricsSchedulingAspect(registry); @@ -64,7 +65,7 @@ public MetricsSchedulingAspect metricsSchedulingAspect(MeterRegistry registry) { * will always be evaluated to "none". */ @Configuration - @ConditionalOnClass({RestTemplate.class, JoinPoint.class}) + @ConditionalOnClass(name = {"org.springframework.web.client.RestTemplate", "org.aopalliance.intercept.JoinPoint"}) @ConditionalOnProperty(value = "spring.aop.enabled", havingValue = "true", matchIfMissing = true) static class MetricsRestTemplateAspectConfiguration { @Bean