I have a static method on my domain class, and want to get all the business logic out of the domain class definition into the service, but I can't call the service in the domain class static method since the service itself is defined on the instance not the domain class.
What the best solve for this?
E.g.
class Foo {
def fooService
Integer count =0
String name
static void updateFoo(String name) {
def foo = FindByName(name)
fooService.beforeUpdateProcess(foo) //fooService unavailable here
foo.count+=1
foo.save()
}
}