私のuser-domainには、ログイン後に更新したい(last-login)というフィールドがあります(self-exaplantoy)。 は、Tomcat(DEV ENV)を再起動した後、私は次の例外を取得:ログイン後にユーザーのlastLoginプロパティを更新します。
groovy.lang.MissingMethodException:メソッドのシグネチャなし:静的photoo.user.User.findById()は引数の型に適用されます:(java.langで.LONG)値:[2]考えられる解決策:のfindAll(groovy.lang.Closure)、見つける(groovy.lang.Closure)
私は私のConfig.groovyに次のコードを使用します。
// callback event, after a successful login
grails.plugins.springsecurity.onInteractiveAuthenticationSuccessEvent = { e, appCtx ->
def user = User.findById(appCtx.springSecurityService.principal.id)
User.withTransaction {
if(!user.isAttached())
user.attach()
user.lastLogin = new Date()
user.save(flush: true)
}
}
例外を回避するにはどうすればよいのですか? thx