Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9019671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:50:17+00:00 2026-06-16T04:50:17+00:00

I am using Spring Security core on this Grails project. I get the error

  • 0

I am using Spring Security core on this Grails project. I get the error “password” cannot be resolve in the BootStrap class.

I have this domain class:

class Person {

transient springSecurityService

String realName
String username
String password
boolean enabled
boolean accountExpired
boolean accountLocked
boolean passwordExpired

static constraints = {
    username blank: false, unique: true
    password blank: false
}

static mapping = {
    password column: '`password`'
}

Set<Authority> getAuthorities() {
    PersonAuthority.findAllByPerson(this).collect { it.authority } as Set
}

def beforeInsert() {
    encodePassword()
}

def beforeUpdate() {
    if (isDirty('password')) {
        encodePassword()
    }
}

protected void encodePassword() {
    password = springSecurityService.encodePassword(password)
}
}

and this is my BootsStrap class:

class BootStrap {




def init = { servletContext ->

    if (!Person.count()) {
        createData()
    }
}
def destroy = {
}

private void createData() {
    def userRole = new Authority(authority: 'ROLE_USER').save()



    [harry: 'Harry Brock'].each { userName, realName ->
        def user = new Person(username: userName, realName: realName, password: password, enabled: true).save()
        PersonAuthority.create user, userRole, true
    }
}
}

I am using Grails 2.2 and Spring Security Core 1.2.7.3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:50:18+00:00Added an answer on June 16, 2026 at 4:50 am

    Within BootStrap you are using a undefined variable named password.

    I added a comment above the line with the problem:

    [harry: 'Harry Brock'].each { userName, realName ->
      // userName and realName are closure parameters, enabled is always true.. but where is password defined?
      def user = new Person(username: userName, realName: realName, password: password, enabled: true).save()
      PersonAuthority.create user, userRole, true
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed spring-security-core in a grails project, but for some reason, IDEA didn't
Note I am using Grails 2.0.4 and spring security core plugin 1.2.7.2 This appears
I am new to grails. I am using grails 1.3.7, and spring security core
I am using Spring Security 3.0.3 for a project. This project has 3 areas
I am using spring security core plug in in my grails app. When I
I am using Grails multi-tenant plugin with single-tenant mode. I have used spring security
I have configured spring security core plugin using requestmap table inside the database.. Now
I'm using Grails Spring Security Core plugin and I need to perform a few
I am using Grails Spring Security Plugin 1.2.7.3 and would like to have the
I'm sure this is a fairly common situation. I'm using the Spring Security Core

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.