您好,我想我有一个简单的问题。
我需要在我的代码中使用 DictionaryServicedictionaryService 更具体我需要这个:
this.dictionaryService.getAspect(VykazModel.qProps);
要工作我得到的所有内容都是空指针异常,所以我知道我必须在某个地方定义dictionaryService,但我不知道我应该如何以及什么值设置。
我找到了这个http://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/dictionary/DictionaryService.html但它仍然没有告诉我如何设置 DictionaryService 才能使用它。
最佳答案
您可以将其注入(inject)到您的 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>
关于java - 露天 Java 词典服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35365902/