Issue Injecting dataSource into Grails Service -


i running issue when trying following in serivce:

class sendingmailservice {  def datasource // spring-bean "datasource" auto-injected  def sendxlsmail() {  def db = new sql(datasource)   //additional code such query, execution follows  } } 

when execute code error: "must specify non-null connection". have read believe code above should work (this not unit test)...so missing respect grails services?

thank here,

ok months later had time one.

i tried couple of things datasource autoinject service kept getting null connection. landed on passing datasource controller not elegant @ least works. hope helps else out have seen similar issues out there. still know why autoinject not work think have dig deeper grails understand that.

class mycontroller {  def datasource  def somecontrollermethod() {  myservice myservice = new myservice() myservice.servicemethodquery(datasource)   } } 

//////////////////////

class myservice {  def servicemethodquery(object datasource){  //use datasource }  } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -