2016-09-07 205 views
0

我已经使用InputStream将图像文件保存到mongodb,当它被转换回Object类时, 。

型号

private Object image1; 
    public Object getImage1() { 
      return image1; 
     } 

    public void setImage1(InputStream image1) { 
      this.image1 = image1; 
     } 

异常在该行

DBObject getDoc = cursorDoc.next(); 
      User usr = mongoTemplate.getConverter().read(User.class, getDoc); 

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jvnet.mimepull.DataHead$ReadMultiStream]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: argument type mismatch 
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:158) 
    at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:75) 

回答

0

抛出可能是有意义的改变 “图像1” 的类型为InputStream的?

+0

它抛出同样的例外 –

相关问题