プロパティ選択可能なトランスポートプロトコルを使用するプロキシビーンを使用しています。私の問題は、Beanのプロパティは変換できないということですが、なぜそれが本当にわかりません。これは状況です:春にプロキシオブジェクトを配線する方法は?
マイプロパティ:service.protocol = RMI
<!-- This is the 'multiplexing' factory bean (using this because properties
cannot be used in bean names and aliases -->
<bean name="dbFormGenWindowComponent"
class="org.springframework.beans.factory.config.BeanReferenceFactoryBean">
<property name="targetBeanName" value="dbFormGenWindowComponent-${service.protocol}invoker" />
</bean>
<!-- Here are the service invoker beans with two protocols: -->
<bean name="dbFormGenWindowComponent-rmiinvoker" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="${ringwindow.serviceURL.rmi}/${ringwindow.service.name}-dbFormGenWindowComponent"/>
<property name="serviceInterface" value="foo.bar.service.formgen.windows.FormGenWindowComponent" />
<property name="lookupStubOnStartup" value="false"/>
</bean>
起動時に例外がある:
org.springframework.beans.TypeMismatchException : [$ Proxy541]タイプのプロパティ値を必須に変換できませんでしたプロパティ 'formGenWindowComponent'には [foo.bar.service.formgen.windows.FormGenWindowComponent] を入力してください。 ネストされた例外は java.lang.IllegalArgumentExceptionがありません: は、プロパティのために必要なタイプ [foo.bar.service.formgen.windows.FormGenWindowComponent] に[$ Proxy541]タイプ の値を変換できません 'formGenWindowComponent': 一致する編集者または変換 の戦略が見つかりました
入れ子のファクトリーBeanはうまく動作するはずです。この仕事をどうやって手に入れるか考えていますか?
私が言ったことは、私のプロキシはインターフェイスのもので、プラグインされたBeanもインターフェイスのgetter/setterを宣言しています。しかしこれを調べてみると、私のすべてのBeanReferenceFactoryBeansは同じプロキシを指している、これは本当の問題でした。私はすべてのClassCastExceptionsが非常に同じ番号のプロキシオブジェクトについて苦情を言いました。:-(あなたの種類の助けに感謝Bozho! – jb33