Last updated by dominicclifton 4 years ago

Auto Reloading

When a Grails application is executed via the 'grails run-app' command it is configured for auto-reloading (development mode). This mode is disabled when a WAR is created via the 'grails war' command.

Most Grails artifacts (controllers, tag libs, services etc.) are reloadable in Grails, however there are some quirks:

  • Services can only be reloaded when using untyped injection such as:
def testService // works
TestService testService // will thrown an error when reloading
  • Domain Classes are re-mapped to the database at runtime. If the data source is configured to auto-generate the database via the 'update' setting of the 'dbCreate' property it will do its best effort to update the database. This process doesn't always go smoothly however and changing domain classes occasionally require an application restart
  • In Grails 0.6 and beyond, classes under src/java and src/groovy are reloaded, but the way this work is the run a continuous look that checks for changes and then restarts the container. On slower machines this can be quite processor intensive and can also result in occasional OutOfMemory or OutOfPermGenSpace type errors. If you don't want this feature then you can disable it with:
grails -noreloading run-app

Note that with grails 2.2.1, and possibly other versions, the -noreloading argument must be the first command line argument otherwise it is ignored. See for details.