From cc8c23ddfb50f19016a97233a0b97bb6d0adb023 Mon Sep 17 00:00:00 2001 From: Jon Schneider Date: Fri, 16 Jun 2017 23:28:02 -0500 Subject: [PATCH] Fix boot 1 configuration to not require AOP --- .../metrics/boot/MetricsBoot1Configuration.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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