Not an issue. Just noticed while digging through the implementation: Looks like the ResourceHttpMessageConverter can construct a value that doesn't implement the requested type if that type extends the non-final ByteArrayResource type.
|
else if (Resource.class == clazz || ByteArrayResource.class.isAssignableFrom(clazz)) { |
|
byte[] body = StreamUtils.copyToByteArray(inputMessage.getBody()); |
|
return new ByteArrayResource(body) { |
|
@Override |
|
public @Nullable String getFilename() { |
|
return inputMessage.getHeaders().getContentDisposition().getFilename(); |
|
} |
|
}; |
|
} |
the condition should probably be
else if (Resource.class == clazz || clazz.isAssignableFrom(ByteArrayResource.class)) {
which I guess could then be simplified to
else if (clazz.isAssignableFrom(ByteArrayResource.class)) {
(but maybe this simplification would be a de-optimization if clazz == Resource.class is a common case).