Spring框架里面将jdbcTemplate注入Controller里面,JDBC连接会不会自动关闭?

因为业务原因,需要在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会不会释放掉?

[url]http://fengpeng.iteye.com/blog/93897[/url]

这个文章看一下就知道了