Skip to content

Commit 09ded2d

Browse files
committed
Move off deprecated API of Spring HATEOAS' AnnotationMappingDiscoverer.
Fixes GH-2490.
1 parent 47e103b commit 09ded2d

File tree

1 file changed

+5
-4
lines changed
  • spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/util

1 file changed

+5
-4
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/util/UriUtils.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.List;
2020

2121
import org.springframework.hateoas.server.core.AnnotationMappingDiscoverer;
22+
import org.springframework.hateoas.server.core.UriMapping;
2223
import org.springframework.util.Assert;
2324
import org.springframework.web.bind.annotation.RequestMapping;
2425
import org.springframework.web.util.UriComponentsBuilder;
@@ -48,9 +49,9 @@ public static String findMappingVariable(String variable, Method method, String
4849
Assert.hasText(variable, "Variable name must not be null or empty");
4950
Assert.notNull(method, "Method must not be null");
5051

51-
String mapping = DISCOVERER.getMapping(method);
52+
UriMapping mapping = DISCOVERER.getUriMapping(method);
5253

53-
return new org.springframework.web.util.UriTemplate(mapping) //
54+
return new org.springframework.web.util.UriTemplate(mapping.getMapping()) //
5455
.match(lookupPath) //
5556
.get(variable);
5657
}
@@ -65,8 +66,8 @@ public static List<String> getPathSegments(Method method) {
6566

6667
Assert.notNull(method, "Method must not be null");
6768

68-
String mapping = DISCOVERER.getMapping(method.getDeclaringClass(), method);
69+
UriMapping mapping = DISCOVERER.getUriMapping(method.getDeclaringClass(), method);
6970

70-
return UriComponentsBuilder.fromPath(mapping).build().getPathSegments();
71+
return UriComponentsBuilder.fromPath(mapping.getMapping()).build().getPathSegments();
7172
}
7273
}

0 commit comments

Comments
 (0)