Hi all,
All the examples I have seen with regard to auto-wiring DAO classes have the DataSource being injected into the DAO instance via setter, and a JdbcTemplate created from the DataSource.
I was thinking about injecting the JdbcTemplate directly rather than using the DataSource to create one, but was wondering if there was some drawback to this that has not occurred to me. The only thing I can think of is that it might make the DAO slightly less generic, menaing if I were to switch from JdbcTemplate to needing a HibernateTemplate or back to raw JDBC, I would need to change the Spring config file along with the code.
No big deal, but it does save me a line of code when the JdbcTemplate is already there.![]()
Thanks,
Art


Reply With Quote