Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include autowire configuration for example #101

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!