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

posted @ 2017-03-17 18:52  遁地龙卷风  阅读(828)  评论(0编辑  收藏  举报