From 9b61b3387f1dd50d4528da2c7c9970783862f4c3 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 22 Nov 2017 09:24:38 +0000 Subject: [PATCH] Don't make assumptions about the UriTemplateHandler Fixes gh-115 --- spring-cloud-gateway-mvc/pom.xml | 5 +++++ .../org/springframework/cloud/gateway/mvc/ProxyExchange.java | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) 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;