Failed to instantiate [java.lang.Integer]: Is it an abstract class?; nested exception is java.lang.InstantiationException: java.lang.Integer
原因:查询数据库需要返回一个Integer类型的数据,然后有这样写:
int total = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<Integer>(Integer.class), cid);
不能写(BeanPropertyRowMapper<Integer>(Integer.class))这个。
解决:int total = jdbcTemplate.queryForObject(sql,Integer.class, cid);这样写才对。