开发者

Service method or domain static method in Grails?

This is a design question:

  • when do I need to create/use a static method (in a domain class for instance)
  • when do I need to create/use a service instead?

What is the difference开发者_JAVA百科 between them?


If the method is to do only with the behaviour/details of the domain class then I'd make it a method on the domain (not necessarlily a static one). If it is more related to business logic then I'd put it in a service.

cheers

Lee

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜