Use MethodInvocationInfo class loader in case of core JDK interface type
Closes gh-30210
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -240,7 +240,7 @@ public class MvcUriComponentsBuilderTests {
|
||||
assertThat(uriComponents.toUriString()).isEqualTo("http://localhost/");
|
||||
}
|
||||
|
||||
@Test // gh-29897
|
||||
@Test // gh-29897
|
||||
public void fromMethodNameInUnmappedControllerMethod() {
|
||||
UriComponents uriComponents = fromMethodName(UnmappedControllerMethod.class, "getMethod").build();
|
||||
|
||||
@@ -384,7 +384,15 @@ public class MvcUriComponentsBuilderTests {
|
||||
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21");
|
||||
}
|
||||
|
||||
@Test // SPR-16710
|
||||
@Test // SPR-16710
|
||||
public void fromMethodCallWithCharSequenceReturnType() {
|
||||
UriComponents uriComponents = fromMethodCall(
|
||||
on(BookingControllerWithCharSequence.class).getBooking(21L)).buildAndExpand(42);
|
||||
|
||||
assertThat(uriComponents.encode().toUri().toString()).isEqualTo("http://localhost/hotels/42/bookings/21");
|
||||
}
|
||||
|
||||
@Test // SPR-16710
|
||||
public void fromMethodCallWithStringReturnType() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> {
|
||||
UriComponents uriComponents = fromMethodCall(
|
||||
@@ -403,7 +411,6 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void fromMappingNamePlain() {
|
||||
|
||||
initWebApplicationContext(WebConfig.class);
|
||||
|
||||
this.request.setServerName("example.org");
|
||||
@@ -417,7 +424,6 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void fromMappingNameWithCustomBaseUrl() {
|
||||
|
||||
initWebApplicationContext(WebConfig.class);
|
||||
|
||||
UriComponentsBuilder baseUrl = UriComponentsBuilder.fromUriString("https://example.org:9999/base");
|
||||
@@ -426,9 +432,8 @@ public class MvcUriComponentsBuilderTests {
|
||||
assertThat(url).isEqualTo("https://example.org:9999/base/people/123/addresses/DE");
|
||||
}
|
||||
|
||||
@Test // SPR-17027
|
||||
@Test // SPR-17027
|
||||
public void fromMappingNameWithEncoding() {
|
||||
|
||||
initWebApplicationContext(WebConfig.class);
|
||||
|
||||
this.request.setServerName("example.org");
|
||||
@@ -442,7 +447,6 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void fromMappingNameWithPathWithoutLeadingSlash() {
|
||||
|
||||
initWebApplicationContext(PathWithoutLeadingSlashConfig.class);
|
||||
|
||||
this.request.setServerName("example.org");
|
||||
@@ -456,7 +460,6 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void fromControllerWithPrefix() {
|
||||
|
||||
initWebApplicationContext(PathPrefixWebConfig.class);
|
||||
|
||||
this.request.setScheme("https");
|
||||
@@ -470,7 +473,6 @@ public class MvcUriComponentsBuilderTests {
|
||||
|
||||
@Test
|
||||
public void fromMethodWithPrefix() {
|
||||
|
||||
initWebApplicationContext(PathPrefixWebConfig.class);
|
||||
|
||||
this.request.setScheme("https");
|
||||
@@ -714,6 +716,17 @@ public class MvcUriComponentsBuilderTests {
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/hotels/{hotel}")
|
||||
static class BookingControllerWithCharSequence {
|
||||
|
||||
@GetMapping("/bookings/{booking}")
|
||||
public CharSequence getBooking(@PathVariable Long booking) {
|
||||
return "url";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/hotels/{hotel}")
|
||||
static class BookingControllerWithString {
|
||||
|
||||
Reference in New Issue
Block a user