I want to instantiate a Datasource in the Dao Class. I’m following the Spring tutorial http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/jdbc.html. This is my code snippet:
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.*;
public class JdbcUserDao implements UserDao {
private JdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource){
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
but I get a “DataSource cannot be resolved to a type”.
How can I fix this?
You need to import it, that’s all: