,將會有一個名爲DataSource.groovy
的文件。比如如下:如何在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
設置在運行時動態。
爲什麼你需要動態主機? – chrislovecnm