开发者

Service method or domain static method in Grails?

开发者 https://www.devze.com 2022-12-08 23:12 出处:网络
This is a design question: when do I need to create/use a static method (in a domain class for instance)

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

精彩评论

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