I am trying to inject ‘GraauditService’ into grails ‘User’ domain class.
I am using grails 1.3.7
I have tried direct injection method as I do in controllers
import com.gra.audit.GraauditService
class User {
def graauditService // or even GraauditService graauditService with graauditService as transient
.......
the above does not work. graauditService is always coming up as null
I also tried to inject through ApplicationHolder as shown here
But looks like ApplicationHolder is deprecated now
How can I use the service in the domain class?
For Grails 1.3.7, the solution is to inject it through the
ApplicationHolder, as shown here by Burt Beckwith.The above solutions may work for Grails 2.0, but not for 1.3.7 or earlier.