-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: taskA general taskA general task
Milestone
Description
Sachin Lad opened SPR-16419 and commented
It looks like with Spring v5, DefaultUriBuilderFactory does not expand correctly if uriTemplate contains "protocol + hostname" as templated. This UriBuilder is used in RestTemplate to expand the templatedUris. Such templatedUri works well with Spring 1.5.x.
Looks like DefaultUriBuilderFactory is newly introduced in Spring v5 so may be this is not bug but the functionality has changed? But this breaks bunch of test code so I am considering this as regression.
Here is the unit test to reproduce it -
// Some comments here
@Test
public void testUrlBuilder() throws URISyntaxException {
String uriTemplate = "{baseUrl}/info";
String[] vars = new String[]{"http://localhost:8085"};
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory();
URI uri = factory.expand(uriTemplate, vars);
assertEquals(new URI("http://localhost:8085/info"), uri);
}In Spring 4.x it looks like the uriTemplate is expanded using DefaultUriTemplateHandler which works well -
@Test
public void testUrlBuilder() throws URISyntaxException {
String uriTemplate = "{baseUrl}/info";
String[] vars = new String[]{"http://localhost:8085"};
DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
URI uri = handler.expand(uriTemplate, vars);
assertEquals(new URI("http://localhost:8085/info"), uri);
}Affects: 5.0.3
Referenced from: commits 4f28c28
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: taskA general taskA general task