Spring 弹簧启动执行器在@AutoConfigureMockRestServiceServer处断裂

Spring 弹簧启动执行器在@AutoConfigureMockRestServiceServer处断裂,spring,spring-boot,spring-boot-actuator,Spring,Spring Boot,Spring Boot Actuator,我有一个类使用以下方法构建多个s: 对于我的测试设置,我使用和模拟响应,使用: 当我在pom中取消对spring boot exactor依赖项的注释时,我的测试通过,在另一个场景中失败,并显示以下消息 预期:/some/path/parameter 实际:http://localhost:8080/rest/pos/some/path/withParameters 通过调试我注意到spring boot actuator应用了一个“”来支持rest模板的内置指标。但是,这会导致我在中发现的以下

我有一个类使用以下方法构建多个s:

对于我的测试设置,我使用和模拟响应,使用:

当我在pom中取消对
spring boot exactor
依赖项的注释时,我的测试通过,在另一个场景中失败,并显示以下消息

预期:/some/path/parameter
实际:http://localhost:8080/rest/pos/some/path/withParameters

通过调试我注意到
spring boot actuator
应用了一个“”来支持rest模板的内置指标。但是,这会导致我在中发现的以下代码出现问题:

因为如上所述,spring boot actuator注册了一个“”,这导致上述代码无法识别RootUriTemplateHandler,因此无法使用匹配请求


我在这里遗漏了什么来让它工作呢?

正如所指出的,这似乎是Spring boot中的一个bug。I.

这听起来像是Spring Boot中的一个bug。你能不能,最好是用最少的样本来重现这个问题。
private RestTemplate build(RestTemplateBuilder restTemplateBuilder) {
    return restTemplateBuilder
      .rootUri("http://localhost:8080/rest")
      .build();
}
mockServerRestTemplateCustomizer.getServer()
  .expect(ExpectedCount.times(2),
        requestToUriTemplate("/some/path/{withParameters}", "withParameters"))
    .andRespond(withSuccess());
public static RequestExpectationManager forRestTemplate(RestTemplate restTemplate,
        RequestExpectationManager expectationManager) {
    Assert.notNull(restTemplate, "RestTemplate must not be null");
    UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
    if (templateHandler instanceof RootUriTemplateHandler) {
        return new RootUriRequestExpectationManager(((RootUriTemplateHandler) templateHandler).getRootUri(),
                expectationManager);
    }
    return expectationManager;
}