Grails:在不连接数据库的情况下启动应用程序 [英] Grails : start the application without connecting to database

查看:19
本文介绍了Grails:在不连接数据库的情况下启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 grails 中有一个应用程序,我可以更改欢迎页面中的参数,包括数据库配置(服务器、用户名等),我从数据源外部化了 db 配置,以便我可以更改它.我想要做的是有可能在没有配置任何数据库的情况下启动应用程序,所以我可以在欢迎页面中配置它.这可能与 grails 吗?我希望至少加载第一页(此页面不会从数据库中检索任何信息).

I have an application in grails, which i can the change the parameters in the welcome page, database configuration included (server, username, ...), i externalized the db configuration from the datasource so i can change it. What i want to do, is to have the possibility to start the application without any database configured, so i can configure it after that, in the welcome page. Is this possible with grails ? i want at least load the first page (this page doesn't retrieve any information from the db).

谢谢!

推荐答案

不久前我写了一篇关于这些方面的博客文章:http://burtbeckwith.com/blog/?p=312

I did a blog post along these lines a while back: http://burtbeckwith.com/blog/?p=312

我不确定它是否仍然适用于 2.0,但它不应该需要太多调整.通过延迟数据源的创建,您可以配置数据源 bean 或 Grails 配置中的连接属性,然后下一个连接请求将使用新配置.

I'm not sure if it still works with 2.0, but it shouldn't require too much tweaking. By delaying the creation of the datasource, you can configure the connection properties of the DataSource bean or in the Grails config and after that the next connection request will use the new configuration.

这篇关于Grails:在不连接数据库的情况下启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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