From what I understand, both DataSource
and JdbcTemplates
are threadsafe
, so you can configure a single instance of a JdbcTempla
After so many years, and see this question again, I think we can create "Jdbc Template" with singleton first, then inject to DAO, so it is only one instance For the Template.
then you can inject template to DAO or DAO extends JdbcDaoSupport.
public final void setJdbcTemplate(JdbcTemplate jdbcTemplate)
{
this.jdbcTemplate = jdbcTemplate;
initTemplateConfig();
}