因为业务原因,需要在Controller里面直接用到ResultSet.
在Controller里面是这样用的:
private JdbcTemplate jdbcTemplate = null;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
...
this.jdbcTemplate.query(sql, new ResultSetExtractor() {
public Object extractData(ResultSet rs) throws SQLException {
...
}
...
}
不知道这样用完后这个JDBC会不会释放掉?