Feature Switching plugin for Grails 2 and 3
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


Build Status Feature Switcher Plugin for Grails


Features can be turned on and off in your configuration using the following format

  features {
    myfeature {
      enabled = true

Where myfeature is the name of the feature you are configuring.

Usage in Controllers and Services

To execute a block of code when the feature 'myfeature' is enabled:

  withFeature('myfeature') {
    // do something

When the feature 'myfeature' is not enabled:

  withoutFeature('myfeature') {
    // do something

Usage in GSPs

To execute some markup when the feature 'myfeature' is enabled:

  <feature:enabled feature="myfeature">
     <h1>The feature is enabled!</h1>

And the same only when the feature is not enabled:

  <feature:disabled feature="myfeature">
    <h1>The feature is disabled!</h1>

Toggling switches via the admin page

The admin page is accessible at


Features highlighted in green are enabled, and those in red are disabled. Clicking the 'toggle' button on any feature will disable or enable that particular feature.

If you want to toggle features easily in a test, you can simply hit the url


which will toggle that feature on or off depending on its current state.

These state changes will only last as long as the application is running, the state is not persisted and is read from configuration on start-up.

Toggling switches via a restful URL

The restful urls for enabling and disabling features are:

To enable:


To disable:


The response from these is a JSON result explaining if the feature has been enabled or disabled:

{"your-feature-name": "disabled"}

Toggling of a non-existent feature will cause a 500 with an IllegalArgumentException including the name of the feature.