Skip to content

Commit

Permalink
Merge pull request #101 from joemccall86/patch-1
Browse files Browse the repository at this point in the history
Include autowire configuration for example
  • Loading branch information
puneetbehl authored Oct 6, 2023
2 parents b3b70ef + c1c9bc4 commit 38add2b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ class Person {
static constraints = {
lastUpdatedBy nullable: true
}
static mapping = {
autowire true
}
def beforeUpdate() {
lastUpdatedBy = securityService.currentAuthenticatedUsername()
}
}
----

Notice the usage of `autowire true` above. This is required for the bean `securityService` to be injected.


==== The beforeDelete event

Expand Down Expand Up @@ -382,4 +388,4 @@ autoTimestampEventListener.withoutTimestamps {
}
----

WARNING: Because the timestamp handling is only disabled for the duration of the closure, you must flush the session during the closure execution!
WARNING: Because the timestamp handling is only disabled for the duration of the closure, you must flush the session during the closure execution!

0 comments on commit 38add2b

Please sign in to comment.