我的Grails应用程序中有一个服务。
尝试阅读如下所示的配置:
MyService {
def grailsApplication
def myMethode(params){
def var = grailsApplication.config.com.application.document.extension
.....
}
给出以下例外:
no such property : com for class:MyService
Config.groovy中:
//....
com.application.document.extension= [ 'Image' : [[mimeType:'image/png',extensions: ['png']],
[mimeType:'image/jpeg',extensions:['jpg','jpeg']]],
'Document' : [[mimeType:'application/pdf',extensions:['pdf']],
[mimeType:'application/vnd.ms-powerpoint',extensions:['ppt','pps']],
[mimeType:'application/vnd.openxmlformats- officedocument.presentationml.presentation',extensions:['pptx']],
[mimeType:'application/vnd.ms-excel',extensions:['xls']],
[mimeType:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',extensions:['xlsx']],
[mimeType:'application/msword',extensions:['doc']],
[mimeType:'application/vnd.openxmlformats-officedocument.wordprocessingml.document',extensions:['docx']],
[mimeType:'image/png',extensions:['png']],
[mimeType:'application/postscript',extensions:['ai','eps','psd']],
[mimeType:'application/zip',extensions:['zip']],
[mimeType:'text/plain',extensions:['txt']]]
]
答案 0 :(得分:0)
您肯定在Config.groovy中没有此类属性 com.application.document.extension 。发布你如何定义它。