diff --git a/spring-cloud-sleuth-core/pom.xml b/spring-cloud-sleuth-core/pom.xml
index be1114e5c..f752dc33c 100644
--- a/spring-cloud-sleuth-core/pom.xml
+++ b/spring-cloud-sleuth-core/pom.xml
@@ -152,12 +152,6 @@
rxjava
true
-
-
- org.springframework.data
- spring-data-rest-webmvc
- true
-
com.squareup.okhttp3
okhttp
@@ -301,11 +295,6 @@
spring-orm
test
-
- org.springframework.boot
- spring-boot-starter-data-rest
- test
-
com.h2database
h2
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java
deleted file mode 100644
index 4aa316ceb..000000000
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceSpringDataBeanPostProcessor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2013-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.sleuth.instrument.web;
-
-import java.util.Collections;
-
-import javax.servlet.http.HttpServletRequest;
-
-import brave.spring.webmvc.SpanCustomizingAsyncHandlerInterceptor;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.data.rest.webmvc.support.DelegatingHandlerMapping;
-import org.springframework.web.servlet.HandlerExecutionChain;
-import org.springframework.web.servlet.HandlerMapping;
-
-/**
- * Bean post processor that wraps Spring Data REST Controllers in named Spans.
- *
- * @author Marcin Grzejszczak
- * @since 1.0.3
- */
-class TraceSpringDataBeanPostProcessor implements BeanPostProcessor {
-
- private static final Log log = LogFactory
- .getLog(TraceSpringDataBeanPostProcessor.class);
-
- private final ApplicationContext applicationContext;
-
- TraceSpringDataBeanPostProcessor(ApplicationContext applicationContext) {
- this.applicationContext = applicationContext;
- }
-
- @Override
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- if (bean instanceof DelegatingHandlerMapping
- && !(bean instanceof TraceDelegatingHandlerMapping)) {
- if (log.isDebugEnabled()) {
- log.debug("Wrapping bean [" + beanName + "] of type ["
- + bean.getClass().getSimpleName()
- + "] in its trace representation");
- }
- return new TraceDelegatingHandlerMapping((DelegatingHandlerMapping) bean,
- this.applicationContext);
- }
- return bean;
- }
-
- @Override
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- private static class TraceDelegatingHandlerMapping extends DelegatingHandlerMapping {
-
- private final DelegatingHandlerMapping delegate;
-
- private final ApplicationContext applicationContext;
-
- TraceDelegatingHandlerMapping(DelegatingHandlerMapping delegate,
- ApplicationContext beanFactory) {
- super(Collections.emptyList());
- this.delegate = delegate;
- this.applicationContext = beanFactory;
- }
-
- @Override
- public int getOrder() {
- return this.delegate.getOrder();
- }
-
- @Override
- public HandlerExecutionChain getHandler(HttpServletRequest request)
- throws Exception {
- HandlerExecutionChain handlerExecutionChain = this.delegate
- .getHandler(request);
- if (handlerExecutionChain == null) {
- return null;
- }
- handlerExecutionChain.addInterceptor(this.applicationContext
- .getBean(SpanCustomizingAsyncHandlerInterceptor.class));
- return handlerExecutionChain;
- }
-
- }
-
-}
diff --git a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
index a246f91f9..081298eae 100644
--- a/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
+++ b/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceWebServletAutoConfiguration.java
@@ -31,7 +31,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.cloud.sleuth.SpanNamer;
-import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -58,13 +57,6 @@ public class TraceWebServletAutoConfiguration {
*/
public static final int TRACING_FILTER_ORDER = TraceHttpAutoConfiguration.TRACING_FILTER_ORDER;
- @Bean
- @ConditionalOnClass(name = "org.springframework.data.rest.webmvc.support.DelegatingHandlerMapping")
- public static TraceSpringDataBeanPostProcessor traceSpringDataBeanPostProcessor(
- ApplicationContext applicationContext) {
- return new TraceSpringDataBeanPostProcessor(applicationContext);
- }
-
@Bean
TraceWebAspect traceWebAspect(Tracing tracing, SpanNamer spanNamer) {
return new TraceWebAspect(tracing, spanNamer);
diff --git a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java b/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java
deleted file mode 100644
index 5da48eed5..000000000
--- a/spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/instrument/web/SpringDataInstrumentationTests.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright 2013-2019 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.sleuth.instrument.web;
-
-import java.net.URI;
-import java.util.stream.Stream;
-
-import javax.annotation.PostConstruct;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import brave.Tracer;
-import brave.sampler.Sampler;
-import org.awaitility.Awaitility;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import zipkin2.Span;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
-import org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration;
-import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-import org.springframework.hateoas.PagedModel;
-import org.springframework.http.RequestEntity;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.client.RestTemplate;
-
-import static org.assertj.core.api.Assertions.tuple;
-import static org.assertj.core.api.BDDAssertions.then;
-
-@RepositoryRestResource
-interface ReservationRepository extends JpaRepository {
-
-}
-
-/**
- * @author Marcin Grzejszczak
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = ReservationServiceApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.sleuth.http.legacy.enabled=true")
-@DirtiesContext
-@ActiveProfiles("data")
-public class SpringDataInstrumentationTests {
-
- @Autowired
- RestTemplate restTemplate;
-
- @Autowired
- Environment environment;
-
- @Autowired
- Tracer tracer;
-
- @Autowired
- ArrayListSpanReporter reporter;
-
- @Before
- public void setup() {
- this.reporter.clear();
- }
-
- @Test
- public void should_create_span_instrumented_by_a_handler_interceptor() {
- long noOfNames = namesCount();
-
- then(noOfNames).isEqualTo(8);
- then(this.reporter.getSpans()).isNotEmpty();
- Awaitility.await().untilAsserted(() -> {
- // Make sure the data is attached to the right side of the span
- then(this.reporter.getSpans())
- .extracting(Span::kind, Span::name,
- s -> s.tags().get("mvc.controller.class"))
- .containsExactlyInAnyOrder(
- tuple(Span.Kind.CLIENT, "http:/reservations", null),
- tuple(Span.Kind.SERVER, "http:/reservations",
- "RepositoryEntityController"));
- });
- then(this.tracer.currentSpan()).isNull();
- }
-
- long namesCount() {
- return this.restTemplate
- .exchange(RequestEntity
- .get(URI.create("http://localhost:" + port() + "/reservations"))
- .build(), PagedModel.class)
- .getBody().getMetadata().getTotalElements();
- }
-
- private int port() {
- return this.environment.getProperty("local.server.port", Integer.class);
- }
-
-}
-
-@Configuration
-@EnableAutoConfiguration(exclude = { SecurityAutoConfiguration.class,
- GatewayAutoConfiguration.class, GatewayClassPathWarningAutoConfiguration.class })
-@EntityScan(basePackageClasses = Reservation.class)
-class ReservationServiceApplication {
-
- @Bean
- RestTemplate restTemplate() {
- return new RestTemplate();
- }
-
- @Bean
- SampleRecords sampleRecords(ReservationRepository reservationRepository) {
- return new SampleRecords(reservationRepository);
- }
-
- @Bean
- ArrayListSpanReporter arrayListSpanAccumulator() {
- return new ArrayListSpanReporter();
- }
-
- @Bean
- Sampler alwaysSampler() {
- return Sampler.ALWAYS_SAMPLE;
- }
-
-}
-
-class SampleRecords {
-
- private final ReservationRepository reservationRepository;
-
- SampleRecords(ReservationRepository reservationRepository) {
- this.reservationRepository = reservationRepository;
- }
-
- @PostConstruct
- public void create() throws Exception {
- Stream.of("Josh", "Jungryeol", "Nosung", "Hyobeom", "Soeun", "Seunghue", "Peter",
- "Jooyong")
- .forEach(name -> this.reservationRepository.save(new Reservation(name)));
- this.reservationRepository.findAll().forEach(System.out::println);
- }
-
-}
-
-@Entity
-class Reservation {
-
- @Id
- @GeneratedValue
- private Long id; // id
-
- private String reservationName; // reservation_name
-
- Reservation() { // why JPA why???
- }
-
- Reservation(String reservationName) {
-
- this.reservationName = reservationName;
- }
-
- public Long getId() {
- return this.id;
- }
-
- public String getReservationName() {
- return this.reservationName;
- }
-
- @Override
- public String toString() {
- return "Reservation{" + "id=" + this.id + ", reservationName='"
- + this.reservationName + '\'' + '}';
- }
-
-}