Results 1 to 4 of 4

Thread: Is Boostrap.groovy invoked when a grails war is deployed?

  1. #1
    Join Date
    Sep 2010
    Posts
    6

    Default Is Boostrap.groovy invoked when a grails war is deployed?

    I had assumed it was - but I don't see my seed data in the database.

    Bootstrap is run successfully (I see the seed data in the database) when using run-app.

    If not, is there a way to make it run?

  2. #2
    Join Date
    Jul 2007
    Posts
    123

    Default

    It is run in all environments. Simple enough to test - just add a println in the init closure.

  3. #3
    Join Date
    Jun 2010
    Location
    London
    Posts
    304

    Default

    In addition, I find it useful to enable exceptions for failed validation in BootStrap:
    Code:
    class BootStrap {
        def init = {
            def a = new Author().save(failOnError: true)
            ...
        }
    }
    You'll then know pretty quickly if validation errors are preventing your data from being saved to the database.

  4. #4
    Join Date
    Sep 2010
    Posts
    6

    Default

    Of course, it was due to invalid seed data.

    Thanks for the failOnError tip.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •