在测试jdbctemplate的query方法和queryForObject方法时 按要求传参 报错
代码
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("jdbcTemplate.xml");
JdbcTemplate jdbcTemplateBean = applicationContext.getBean("jdbcTemplate", JdbcTemplate.class);
StringBuilder sql = new StringBuilder();
sql.append("select id,name,tel,createTime from tb_user where id = '1' ");
RowMapper<TbUser> rowMapper = new BeanPropertyRowMapper<>(TbUser.class);
List<TbUser> query = jdbcTemplateBean.query(sql.toString(), rowMapper);
TbUser tbUser = jdbcTemplateBean.queryForObject(sql.toString(), rowMapper);
System.out.println(query.toString());
System.out.println(tbUser);
报错信息
Exception in thread "main" org.springframework.beans.BeanInstantiationException: Failed to instantiate [jdbcTemplat