0

Spring Dynamic Modules を初めて使用しています。バンドルを介してサービス (単純な listofValuesDAO Bean) を公開しようとしましたが、Bean を使用するために別のバンドルに挿入しようとしています。以下は、サービスが公開された Bundle1 の osgi-context.xml の構成タグです。

 <osgi:service ref="listOfValuesDAO" auto-export="interfaces"/>

osgi-context.xml の以下のタグを使用して、Bundle2 で取得しようとしています。

  <osgi:reference id="listOfValuesDAO" interface="com.dao.IListOfValuesDAO" />

問題は、以下の構成を使用して Bundle2 の Bean に注入しようとしたときです。

 <bean id="exportServiceImpl" class="com.service.impl.ExportServiceImpl">
    <property name="listOfValuesDAO" ref="listOfValuesDAO"/>
</bean>

システムは以下の例外をスローします:

 Exception in thread "SpringOsgiExtenderThread-85"org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exportServiceImpl' defined in URL [bundle://325.16:0/META-INF/spring/module-context.xml]: 

Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'listOfValuesDAO' of bean class [com.service.impl.ExportServiceImpl]: 

Bean property 'listOfValuesDAO' is not writable or has an invalid setter method. Did you mean 'listOfValuesDao'?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)

以下は、私の ExportServiceImpl クラスのプロパティです。

public class ExportServiceImpl implements IExportService {
IListOfValuesDAO listOfValuesDao;
public void setListOfValuesDao(IListOfValuesDAO listOfValuesDao) {
    this.listOfValuesDao = listOfValuesDao;
}
public IListOfValuesDAO getListOfValuesDao() {
    return listOfValuesDao;
}
}

誰かがこの問題を解決するのを手伝ってくれませんか?

4

1 に答える 1