I've just noticed the existence of the grails-app/utils
dir. I've never seen it referred to in any documentation (or used in a project). It's created by default whe开发者_如何学编程n you run create-app
, any idea what you're supposed to put in there?
"Utility" code is an obvious guess, but it seems like that should go under the src
dir.
Thanks, Don
the grails-app/utils/
directory is where items like Codecs go.
I'm not sure what else goes there, but you can include other classes there and they will be included within the Application
EDIT:
The grails-app/utils/
directory is meant for "Grails specific utilities" (Artefacts, GrailsClasses, etc.)
Jeff Brown(Core member of the Grails development team) responded to a question on the mailing list that confirms this. He said:
You can put just about anything you like in the
utils
directory but it is really for Grails specific utilities. At the moment I think the only thing really targeted at this directory are custom codecs. Your application classes that are not Grails artifacts should go undersrc/groovy/
You can find an example of a new Grails Artefact in the Constriants plugin. The Author of this plugin recommends that users put their Constraint classes in the grails-app/utils/
directory.
精彩评论