0

私は次のクラスを持っています

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 セキュリティ プラグインを使用しています。

4

1 に答える 1

1

あなたは電話をかけていますが、MME は引数なしsave(Map)で不平を言っています。save()以前、アプリケーションに永続化プラグイン (hibernate/mongodb) をインストールしていなかったときに、この不一致を見たことがあります。これは、スタンドアロン アプリとして実行しようとしていたプラグイン プロジェクトであり、新しいプラグイン プロジェクトのデフォルトの BuildConfig でした。休止状態への依存は含まれません。

于 2012-09-28T19:38:24.910 に答える