Skip to content

Commit e3308c5

Browse files
committed
Fix HttpMessageConverter lookup in PersistentEntityResourceHandlerMethodArgumentResolver.
We now ask the candidate converters whether they can read RepresentationModel instead of the domain type as that's the key type we register the individual ObjectMappers for in Spring HATEOAS. Fixes: GH-2425. Related ticket: GH-2419.
1 parent 56c271d commit e3308c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/PersistentEntityResourceHandlerMethodArgumentResolver.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.data.rest.webmvc.json.BindContextFactory;
4040
import org.springframework.data.rest.webmvc.json.DomainObjectReader;
4141
import org.springframework.data.rest.webmvc.support.BackendIdHandlerMethodArgumentResolver;
42+
import org.springframework.hateoas.RepresentationModel;
4243
import org.springframework.http.MediaType;
4344
import org.springframework.http.converter.HttpMessageConverter;
4445
import org.springframework.http.converter.HttpMessageNotReadableException;
@@ -114,7 +115,7 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m
114115

115116
for (HttpMessageConverter converter : messageConverters) {
116117

117-
if (!converter.canRead(domainType, contentType)) {
118+
if (!converter.canRead(RepresentationModel.class, contentType)) {
118119
continue;
119120
}
120121

0 commit comments

Comments
 (0)