I\'d like to inject my service in Groovy/src class. The normaln dependency injection doesn\'t work:
...
def myService
...
I\'m able to use
You can easily register new (or override existing) beans by configuring them in grails-app/conf/spring/resources.groovy:
// src/groovy/com/example/MyClass.groovy
class MyClass {
def myService
...
}
// resources.groovy
beans = {
myclass(com.example.MyClass) {
myService = ref('myService')
}
}
Also you can check this question about How to access Grails configuration in Grails 2.0?