java.lang.IllegalStateException:Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:DesignSpring3 argetclassescomspring3daoUserDao.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