(Quick Reference)

7 Configuring The Default Dynamic Property Name - Reference Documentation

Authors:

Version: 2.0.0.RC2

7 Configuring The Default Dynamic Property Name

By default the name of the dynamic property that is added to all Grails artefacts for accessing Clojure functions is called clj.

// grails-app/controllers/demo/DemoController.groovy

package demo

class DemoController {

def add(int x, int y) { // this will invoke the add_numbers clojure function… def sum = clj.add_numbers(x, y)

render "The sum of $x and $y is $sum" } }

The name of that property is configurable in application.yml by assigning a value to the grails.clojure.dynamicPropertyName config property.

grails:
    clojure:
        dynamicPropertyName: mathHelper

// grails-app/controllers/demo/DemoController.groovy

package demo

class DemoController {

def add(int x, int y) { // this will invoke the add_numbers clojure function… def sum = mathHelper.add_numbers(x, y)

render "The sum of $x and $y is $sum" } }

The dynamic property can be disabled altogether by assigning false to the grails.clojure.addDynamicProperty config setting in application.yml.

grails:
    clojure:
        addDynamicProperty: false