我有以下课程
class SentryUser {
transient springSecurityService
String userName
String password
boolean enabled
boolean accountExpired = false
boolean accountLocked = false
boolean passwordExpired = false
static constraints = {
userName blank: false, unique: true
password blank: false
}
static mapping = {
password column: '`password`'
}
Set<SentryRole> getAuthorities() {
SentryUserSentryRole.findAllBySentryUser(this).collect { it.sentryRole } as Set
}
def beforeInsert() {
encodePassword()
}
def beforeUpdate() {
if (isDirty('password')) {
encodePassword()
}
}
protected void encodePassword() {
password = springSecurityService.encodePassword(password)
}
}
我在引导程序中调用以下代码
def admin = new SentryUser(userName: "sample@sample.com",
enabled: true).save(failOnError: true)
并得到以下错误
context.GrailsContextLoader Error executing bootstraps: groovy.lang.MissingMethodException: No signature of method: SentryUser.save() is applicable for argument types: () values: []
我正在使用 grails 2.1.1 并使用 spring 安全插件。