在 grails 项目中,会有一个名为DataSource.groovy
. 如下:
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
mongodb {
host = 127.0.0.1// adjust this according to your settings
port = 27017
databaseName = 'test'
username = 'user' // database user and password, if server requires authentication
password = 's3cret'
}
我的问题是如何mongodb.host
在运行时动态设置例如。