Problem implementing grails service in a domain class

I am trying to introduce a GraauditService into a Grails domain class.
I use grails 1.3.7 I tried the direct injection method, as in the controllers
import com.gra.audit.GraauditService

class User { def graauditService // or even GraauditService graauditService with graauditService as transient ....... 

above does not work. graauditService always displayed as null

I also tried to enter through ApplicationHolder as shown here

But it looks like ApplicationHolder is deprecated now

How can I use the service in a domain class?

+4
source share
3 answers

For Grails 1.3.7, the solution should introduce it through the ApplicationHolder , as Bert Beckwith shows here .

The above solutions may work for Grails 2.0, but not for 1.3.7 or earlier.

0
source

Following work for me

 class User { def springSecurityService static transients = ['springSecurityService'] } 
+3
source

Try entering it using the transient keyword:

 class User { transient graauditService } 
0
source

Source: https://habr.com/ru/post/1401266/


All Articles