IllegalArgumentException dataSource jdbcTemplate required

IllegalArgumentException dataSource jdbcTemplate required

If see below exception:

Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: ‘dataSource’ or ‘jdbcTemplate’ is required

Solution: Your are trying to use spring DAO support class either JdbcTemplate or JdbcDaoSupport without doing injection of the data source. As shown in example below dispatcher-servlet.xml file where we are trying to use DAOImpl class to call database but data source dependency has been added:

To fix it please add data source dependency to DAOImpl class as below:

 

Leave a Reply

Your email address will not be published. Required fields are marked *