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 issueSo 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).
精彩评论