露天 java 字典服务

alfresco java dictionary service

你好,我想我有一个简单的问题。 我需要在我的代码中更具体地使用 DictionaryService dictionaryService 我需要这个: this.dictionaryService.getAspect(VykazModel.qProps); 我得到的所有内容都是空指针异常,所以我知道我必须在某个地方定义 dictionaryService 但我不知道我应该如何设置以及设置什么值。

我找到了这个 http://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/dictionary/DictionaryService.html 但它仍然没有告诉我如何设置 dictionaryService 才能使用它。

您可以像 this :

一样简单地将它注入到您的 bean 中
   <?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>