java - Null data source -


i'm making spring project, , i'm getting error when want create jdbc template object:

2015-09-25 11:58:46,260 | taskscheduler-6 |  | error |        org.springframework.scheduling.support.taskutils$loggingerrorhandler:95     |unexpected error occurred in scheduled task. java.lang.illegalargumentexception: datasource must not null 

i declare data source this:

@inject private environmentdatasources envdatasources; 

and need make 2 objects, this:

@override public list<theobjects> getinformation() {      namedparameterjdbctemplate selectopr = new namedparameterjdbctemplate(             envdatasources.getdatasource(environmentobject1));       namedparameterjdbctemplate selectutl = new namedparameterjdbctemplate(             envdatasources.getdatasource(environmentobject2)); 

however, i'm getting null exception. know why happens?

add constructor in daoimpl

@autowired

public servicedaodatasource (datasource) {

super(); setdatasource(datasource); 

}


Comments