2016-02-12 87 views
1

你好,我有一個簡單的問題,我猜。 我需要在我的代碼中使用DictionaryService dictionaryService更具體我需要這個: this.dictionaryService.getAspect(VykazModel.qProps);工作所有我得到的是一個空指針異常,所以我明白我必須定義somewhere字典服務,但我不知道如何以及我想要什麼值組。露天java字典服務

我發現這個http://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/dictionary/DictionaryService.html但它仍然不告訴我如何設置dictionaryService以便使用它。

回答

2

你可以在你的bean注入它那樣簡單this

<?xml version='1.0' encoding='UTF-8'?> 
    <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> 

    <beans> 
     <import resource="classpath:alfresco/application-context.xml"/> 
     <import resource="classpath:alfresco/web-scripts-application-context.xml"/> 

     <bean id="webscript.org.alfresco.repository.test.declarativeSpreadsheetWebScript.get" 
      class="org.alfresco.repo.web.scripts.TestDeclarativeSpreadsheetWebScriptGet" 
      parent="declarativeSpreadsheetWebScript"> 
      <property name="dictionaryService" ref="DictionaryService"/> 
     </bean> 

    </beans>