报错:The method queryForInt(String) is undefined for the type JdbcTemplate
The method JdbcTemplate.queryForInt was deprecated in Spring 3.2.2 and it was removed in Spring 4.2.0.
问题:spring.jar包问题,spring3.2.2支持 queryForInt(String) 方法,但spring4.2.0不支持这个方法,他只支持 queryForObject(String sql, class<T> requiredType) 这个方法。
解决方法:将spring版本降到spring3.2.2,若为maven项目,可在pom.xml将spring依赖中spring的Version改为3.2.2;或者将自己报错处使用的方法换成queryForObject(String sql, class<T> requiredType)。