- Open Grails or Griffon tool window, depending on the desired application type, and right-click the package where a new application element should be added.
- On the context menu of the destination package, choose Alt+InsertCommand N; Command Enter, and choose the element type. , or press
- Type the name of the new element. So doing, you may not care about capitalization: when a new element is generated, its name is capitalized automatically. Click OK. A Groovy class of the selected type is created in the location stipulated by the application structure.
- Add the necessary source code in the editor, using the Groovy-aware coding assistance, refactorings and intention actions.
IntelliJ IDEA provides the possibility to create Grails filters in one click. Just press Alt+InsertCommand N; Command Enter, and choose on the pop-up menu. After executing the CreateFilters.groovy target, the stub class with the filter definition is created under grails-app/conf directory of your Grails application.
Note that IntelliJ IDEA automatically provides the proper name of your filter class ( *Filters.groovy), so you only need to specify the initial characters of the filter class name.