有没有办法在config.groovy文件中放置一个列表? e.g:
environments {
development {
account {
defaultList = [1, 3, 5]
}
尝试在服务中阅读此内容,例如:
def grailsApplication
:
def accountTypesToCreate = grailsApplication.config.account.defaultList
结果
org.codehaus.groovy.runtime.typehandling.GroovyCastException:无法转换对象' groovy.util.ConfigObject@66c2331a'用class' groovy.util.ConfigObject' to class' java.util.List'由于:groovy.lang.GroovyRuntimeException:找不到匹配的构造函数:java.util.List(groovy.util.ConfigObject)
还试过getProperty
答案 0 :(得分:1)
试试这个:
def accountTypesToCreate = grailsApplication.config.account.defaultList as List