Reputation: 11645
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?
Upvotes: 5
Views: 3472
Reputation: 11645
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.
Upvotes: 0
Reputation: 187529
The following works for me
class User {
def springSecurityService
static transients = ['springSecurityService']
}
Upvotes: 3
Reputation: 35864
Try injecting it using the transient keyword:
class User {
transient graauditService
}
Upvotes: 0