Where to place resources in Grails project?

柔情痞子 提交于 2020-01-29 13:12:39

问题


I am wondering if there is a designated place for resource files in a Grails application? I have a csv file that gets loaded into a map (nothing major) but didn't quite know where to put it in the project.

So my question is, is there a dedicated place in the project to place this file? (If so, where?) Or is it better to place it outside of the project?


回答1:


If the csv is going to need updating from time to time, I'd put it external to your grails folder, and point to it from config.groovy.

If it's basically a static file, I'd put it in src/java/resources, and load it with something like this.class.getResource("/resources/file.csv") as you would with a regular java app



来源:https://stackoverflow.com/questions/6077614/where-to-place-resources-in-grails-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!