所以我們能夠在datasource.groovy文件中創建不同的環境設置。我們可以把常用設置環境節點外,像這樣在datasource.groovy中共享環境設置
dataSource {
pooled = false
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
environments {
development {
dataSource {
dbCreate = "create-drop"
url = "jdbc:h2:mem:devDb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb"
}
}
}
但是,有沒有辦法讓我們可以有一定的enviroments共享一些特性,而其他人共享一組不同的,例如具有之間的共享屬性集開發者(奧馬爾,以及斯金格在這種情況下):
dev_dataSource {
pooled = false
driverClassName = "oracle.jdbc.driver.OracleDriver"
username = "dev"
password = "dev"
}
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = "something"
}
environments {
omar {
dataSource {
dev_dataSource {
url = "jdbc:oracle:thin:@omardb.wire.com:1521:devl"
}
}
}
stringer {
dataSource {
dev_dataSource {
url = "jdbc:oracle:thin:@stringerdb.wire.com:1521:devl"
}
}
}
devint {
dataSource {
dbCreate = "create-drop"
url = "jdbc:h2:mem:devDb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb"
}
}
}
在此先感謝...
見更新我的回答如下。 – dmahapatro