Grails:启动应用程序而不连接到数据库 [英] Grails : start the application without connecting to database

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

问题描述

我有一个应用程序在grails,我可以更改欢迎页面中的参数,数据库配置包括(服务器,用户名,...),i从数据源外部化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,但它应该不需要太多的调整。通过延迟数据源的创建,您可以配置DataSource 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天全站免登陆