No suitable constructor found for type [simple type, class com.bonc.vbap.dataservice.core.metadata.i
2016-09-22 11:32
656 查看
这是在使用Jackson对接口或者抽象类进行反序列化的时候出现的问题,从问题中可以看出是构造器的问题,找不到默认的构造器,为什么会找不到默认的构造器呢,因为在创建类的时候JDK自动创建一个默认的无参构造方法,但是我们自己添加了一些构造方法,这样的话就把默认的构造方法改了,也就找不到了。
解决办法是只需要在接口的实现类或者抽象类的子类中添加一个无参构造方法即可。
例如:
package bonc.exam;
public class Test {
private String a;
// 添加此无参构造方法
public Test() {
}
public Test(String a) {
this.a = a;
}
public String getA() {
return a;
}
}
解决办法是只需要在接口的实现类或者抽象类的子类中添加一个无参构造方法即可。
例如:
package bonc.exam;
public class Test {
private String a;
// 添加此无参构造方法
public Test() {
}
public Test(String a) {
this.a = a;
}
public String getA() {
return a;
}
}
相关文章推荐
- No suitable constructor found for type [simple type, class com.beiyanght.dxhbm.vehiclemanagement.business.Student.dto.StudentCondition]: can not insta
- Json转对象失败:"No suitable constructor found for type [simple type, class com.test.faster.domain.respons
- com.fasterxml.jackson.databind.JsonMappingException:No suitable constructor found for type
- No matching bean of type [com.spw.service.UserService] found for dependency
- org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 与No suitable driver found for jdbc:mysql://localhost:3306/XXXx的问题解决方案
- org.codehaus.jackson.map.JsonMappingException: No suitable constructor found for type [si
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut
- 关于springmvc中jackson的No suitable constructor found for type错误
- No qualifying bean of type [com.it.service.DeptService] found for dependency
- No qualifying bean of type [com.shyy.web.service.TreeMapper] found for dependency
- Could not instantiate bean class [com.bjsxt.service.UserService]: No default constructor found;
- JsonMappingException: No suitable constructor found for type
- No converter found for return value of type: class com.taotao.pojo.TbItem
- No qualifying bean of type [com.zc.service.IFancyService] found for dependency
- Spring Data JPA 全局DAO的扩展(第一次用JPA时总是提示 另人抓狂的错误: No property find for type class )
- SpringMVC restful 异常Could not write request: no suitable HttpMessageConverter found for request type
- Spring No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency
- 关于No suitable driver found for com.mysql.jdbc.Driver问题的解决办法
- 解决java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList的问题