2016-02-12 94 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>