TestNg和spring3测试报错:Failed to read candidate component class-遁地龙卷风
java.lang.IllegalStateException:Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\Design\Spring3\target\classes\com\spring3\dao\UserDao.class]; nested exception is java.lang.ArrayIndexOutOfBoundsException: 256
Caused by: java.lang.ArrayIndexOutOfBoundsException: 256
这个错误的原因竟然是我在userDao这个类中使用了lamba表达式
public User findUserByName(final String username)
{
String sql = "select user_name,user_id from t_user where username = ?";
final User user = new User();
jdbcTemplate.query(sql,rs->{
user.setUserId(rs.getInt("user_id"));
user.setUserName(rs.getString("user_name"));
});
return new User();
}
将spring系列版本改为4.3.2.RELEASE 就ok了,之前的是3
无论在哪里出生的孩子,都能看到整个世界