我可以配置Grails没有数据源吗? [英] Can I configure Grails with no datasource?

查看:187
本文介绍了我可以配置Grails没有数据源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Grails应用程序从xml文件加载其数据,并通过罗马提供rss源。我没有任何域类,我的应用程序没有数据源。我不想让Grails加载内存hsql数据库,当应用程序不需要它。删除DataSource.groovy文件阻止我启动Web应用程序,看起来好像数据源是必需的,但是如果我的应用程序不需要数据源,我可以做什么?

  grails create-app nodb 
cd nodb
grails uninstall-plugin hibernate
rm grails-app / conf / DataSource.groovy
grails -controller Foo
< addrenderhi bar到./grails-app/controllers/FooController.groovy>
的索引闭包grails run-app
http:// localhost :8080 / nodb / foo - prints hi bar

对于至少1.1版本的现有应用程序当hibernate是一个插件),你应该能够卸载 - 插件并删除DataSource.groovy文件。


I have a Grails app that loads its data from xml files and delivers rss feeds via rome. I don't have any domain classes and my app has no datasource. I don't want Grails to load an in memory hsql db when the application has no need for it. Deleting the DataSource.groovy file prevents me from launching the web app, it seems as though the datasource is required, but is there anything I can do if my application doesn't need a datasource?

解决方案

The following steps work for a new app (Grails 1.1.1) to run without using a datasource:

grails create-app nodb
cd nodb
grails uninstall-plugin hibernate
rm grails-app/conf/DataSource.groovy
grails create-controller Foo
<add "render "hi bar" to the index closure of ./grails-app/controllers/FooController.groovy>
grails run-app
http://localhost:8080/nodb/foo - prints hi bar

For an existing app on at least version 1.1 (think that's when hibernate was made a plugin) you should be able to just uninstall-plugin and delete the DataSource.groovy file.

这篇关于我可以配置Grails没有数据源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆