Ok months later I had some time to look into this one.
I tried a couple of things to get the dataSource to autoinject into a service but I kept getting a null connection. Ultimately I landed on passing the datasource from the controller which is not very elegant but at least it works. I hope this helps someone else out as I have seen some similar issues out there. Still would like to know why the autoinject does not work but I think I would have to dig deeper into Grails to understand that.
class MyController {
def dataSource
def someControllerMethod() {
MyService myService = new MyService()
myService.serviceMethodQuery(dataSource)
}
}
//////////////////////
class MyService {
def serviceMethodQuery(Object dataSource){
//use your datasource as you normally would
}
}