@Enhances Grails Controller

Viewed 493

I have a Trait defined like so:

@Enhances(ControllerArtefactHandler.TYPE)
trait NullCheckTrait {
   def nullCheck(def object) {
      // code here
   }
}

When I call nullCheck(foo) from my controller, I get the No signature of method exception. If I implements NullCheckTrait on the controller, it works fine. I've read that @Enhances will only work if I create a grails plugin and put the trait there. I'm curious if this is a known issue and if there is a way to get the @Enhances to work from the same grails application as the controller.

2 Answers
Related