Grails Domain Class Initialization
My Grails application has the following Spring bean defined in spring/resources.groovy
calendarService(CalendarService) { bean ->
bean.initMethod = "init"
}
This method looks something like this:
class CalendarService {
void init() {
User.findByEmail("foo@doo.com")
}
}
When I call the dynamic finder findByEmail
, I get a MissingMethodException
. My guess is that I am trying to call this method too early, that is, before the domain classes have added dynamic crawlers to their metaclass. One solution would be to call CalendarService.init()
yourself from Bootstrap.init
rather than instruct Spring to invoke it, but is there a better solution?
Thanks Don
+2
a source to share