Category Archives: jdbcTemplate

Caused by: java.lang.IllegalArgumentException: ‘dataSource’ or ‘jdbcTemplate’ is required

A Simple DAO class extends JdbcDaoSupport, but, unable to inject or @autowired a “dataSource”, the method setDataSource is final, can’t override.


To quickly fix it, uses @PostConstruct to inject the dataSource like this :

public class UserDetailsDaoImpl extends JdbcDaoSupport implements UserDetailsDao {

private DataSource dataSource;

private void initialize() {


Alternatively, create an own implementation of JdbcDaoSupport class, and do whatever you want. Dive inside the source code of JdbcDaoSupport, it’s just a simple helper class to create a jdbcTemplate.

Source :-

111 total views, no views today