开发者

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services

Is this a good practice or should be avoided by all means??

Another worth mentioning problem I encountered is in naming services Example

SomthingGatewayService.groovy can't be initialized in both these ways - SomthingGatewayService somtinggatewayService

- def somtinggatewayService I understand that the problem is in the 2 Capital L开发者_JAVA百科etters 'S'omthing and 'G'ateway before the conventional 'S'ervice, so its probably because of some sort of spring DI issue

So how to resolve this?


Yes, putting Domain classes, services, controllers etc. into packages is a good idea IMO. Refactoring it later can be painful. Especially when dealing big applications or applications that grow over time.

Regarding the second problem: If you have a service called SomthingGatewayService then you'll be able to reference it by def somthingGatewayService (just the first letter is lower case).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜