From 6b006802e23b1819eb9cf67b34544880b53dc83c Mon Sep 17 00:00:00 2001 From: Jonatan Ivanov Date: Wed, 20 Jan 2021 19:31:54 -0800 Subject: [PATCH] Fixing the mockmvc-controller binding for RestTemplate JMH tests (#1829) --- .../benchmarks/jmh/mvc/RestTemplateBenchmarkTests.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/mvc/RestTemplateBenchmarkTests.java b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/mvc/RestTemplateBenchmarkTests.java index 33ad3d4d9..6066b8274 100644 --- a/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/mvc/RestTemplateBenchmarkTests.java +++ b/benchmarks/src/test/java/org/springframework/cloud/sleuth/benchmarks/jmh/mvc/RestTemplateBenchmarkTests.java @@ -39,6 +39,7 @@ import org.openjdk.jmh.annotations.Warmup; import org.springframework.boot.SpringApplication; import org.springframework.cloud.sleuth.benchmarks.app.mvc.SleuthBenchmarkingSpringApp; +import org.springframework.cloud.sleuth.benchmarks.app.mvc.controller.AsyncSimulationController; import org.springframework.cloud.sleuth.benchmarks.jmh.TracerImplementation; import org.springframework.cloud.sleuth.instrument.web.mvc.TracingClientHttpRequestInterceptor; import org.springframework.context.ConfigurableApplicationContext; @@ -87,10 +88,11 @@ public class RestTemplateBenchmarkTests { @Setup public void setup() { - this.withSleuth = new SpringApplication(SleuthBenchmarkingSpringApp.class).run("--spring.jmx.enabled=false", - - "--spring.application.name=withSleuth_" + this.tracerImplementation.name()); - this.mockMvc = MockMvcBuilders.standaloneSetup(this.withSleuth.getBean(SleuthBenchmarkingSpringApp.class)) + this.withSleuth = new SpringApplication(SleuthBenchmarkingSpringApp.class).run( + "--spring.jmx.enabled=false", + "--spring.application.name=withSleuth_" + this.tracerImplementation.name() + ); + this.mockMvc = MockMvcBuilders.standaloneSetup(this.withSleuth.getBean(AsyncSimulationController.class)) .build(); this.tracedTemplate = new RestTemplate(new MockMvcClientHttpRequestFactory(this.mockMvc)); this.tracedTemplate.setInterceptors(