开发者

Define a XML datasource and import it to the grails app in bootstrap stage

my aim is to import some certain data to the database of a Grails app in the bootstrap stage. Say defaultData.xml. Where can I configure this xml datasource's path, so 开发者_如何转开发that I don't need to worry about the tomcat deployment later? What is the most common way to implement this function in Grails?

Many thanks!


Put the xml file in grails-app/conf. The file will be bundled up into a war if you build one. In BootStrap.groovy, you can refer to the file with class.getResource("defaultData.xml"), which will access the file in both a regular development environment and a war deployment.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜