title: Null springSecurityService causes encodePassword to fail in Grails 2.0.1
body: <p>We are working on a new project with Grails 2.0.1 and Spring Security. The create user context fails due to springSecurityService in the User domain object being null. Strangely this occurs only our Linux text box while on all the developer windows boxes it works fine. Not sure if it has anything to do with the environment or whether it is something else. On the linux box this fails consistently.</p>
  
  <p>The user domain class we are using is below (the plugin generated class with a couple of additional fields).  The encodePassword is being handled by the beforeInsert(), beforeUpdate() triggers.</p>
  
  <p>Came across this thread which talks about the transient references causing problems in webflows, which I assume are not being used here, so not sure if this is relevant.
  <a href="http://grails.1312388.n4.nabble.com/Spring-Security-Plugin-1-of-the-time-springSecurityService-null-td4349941.html" rel="noreferrer">http://grails.1312388.n4.nabble.com/Spring-Security-Plugin-1-of-the-time-springSecurityService-null-td4349941.html</a></p>
  
  <pre><code>class User {
  
      transient springSecurityService
  
      static constraints = {
          firstName blank: false, nullable: false, size: 2..100
          lastName blank: false, nullable: false, size: 2..100
          username blank: false, nullable: false, unique : true, email: true
          password blank: false, nullable: false, size: 6..255
      }
  
      static mapping = {
          password column: '`password`'
      }
  
      String username
      String password
      boolean enabled
      boolean accountExpired
      boolean accountLocked
      boolean passwordExpired
  
      /* user details */
      String firstName;
      String lastName;
  
      Set&lt;Role&gt; getAuthorities() {
          UserRole.findAllByUser(this).collect { it.role } as Set
      }
  
      def beforeInsert() {
          encodePassword()
      }
  
      def beforeUpdate() {
          if (isDirty('password')) {
              encodePassword()
          }
      }
  
      protected void encodePassword() {
          password = springSecurityService.encodePassword(password)
      }
  }
  </code></pre>
  
  <p>Thanks in advance</p>