开发者

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

开发者 https://www.devze.com 2023-02-12 04:19 出处:网络
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

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

精彩评论

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