Resolve target type for GenericHttpMessageConverter.canWrite/write

Issue: SPR-16877
This commit is contained in:
Juergen Hoeller
2018-07-16 19:45:35 +02:00
parent cacd14c805
commit b915e42c38
2 changed files with 37 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -932,7 +932,20 @@ public class RequestResponseBodyMethodProcessorTests {
}
private static class JacksonController {
private static class BaseController<T> {
@RequestMapping
@ResponseBody
public List<T> handleTypeInfoList() {
List<T> list = new ArrayList<>();
list.add((T) new Foo("foo"));
list.add((T) new Bar("bar"));
return list;
}
}
private static class JacksonController extends BaseController<ParentClass> {
@RequestMapping
@ResponseBody
@@ -969,15 +982,6 @@ public class RequestResponseBodyMethodProcessorTests {
return entity.getBody();
}
@RequestMapping
@ResponseBody
public List<ParentClass> handleTypeInfoList() {
List<ParentClass> list = new ArrayList<>();
list.add(new Foo("foo"));
list.add(new Bar("bar"));
return list;
}
@RequestMapping
@ResponseBody
public Identifiable handleSubType() {