diff --git a/spring-cloud-gateway-mvc/pom.xml b/spring-cloud-gateway-mvc/pom.xml
index ac3d0eb2ac..1b02149fe5 100644
--- a/spring-cloud-gateway-mvc/pom.xml
+++ b/spring-cloud-gateway-mvc/pom.xml
@@ -25,6 +25,11 @@
spring-boot-starter-test
test
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+ test
+
org.springframework.boot
spring-boot-configuration-processor
diff --git a/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java b/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java
index ff67f9e58e..efd3a4712e 100644
--- a/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java
+++ b/spring-cloud-gateway-mvc/src/main/java/org/springframework/cloud/gateway/mvc/ProxyExchange.java
@@ -66,7 +66,6 @@
import org.springframework.web.method.support.ModelAndViewContainer;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;
-import org.springframework.web.util.AbstractUriTemplateHandler;
/**
* A @RequestMapping
argument type that can proxy the request to a backend.
@@ -463,9 +462,7 @@ private NestedTemplate createTemplate(RestTemplate input) {
NestedTemplate rest = new NestedTemplate();
rest.setMessageConverters(input.getMessageConverters());
rest.setErrorHandler(input.getErrorHandler());
- rest.setDefaultUriVariables(
- ((AbstractUriTemplateHandler) input.getUriTemplateHandler())
- .getDefaultUriVariables());
+ rest.setUriTemplateHandler(input.getUriTemplateHandler());
rest.setRequestFactory(input.getRequestFactory());
rest.setInterceptors(input.getInterceptors());
return rest;