2017-10-10 4 views
0

nullパラメータでカスタムメソッドを呼び出そうとしています。私は引数のプロパティを要素で使用しようとしています。しかし、私はエラー以下になっています。これを行う方法はありますか?メソッドのパラメータとしてnullをSpringに接続する方法は?

<bean id="customJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> 
    <property name="targetObject" ref="customExecutor" /> 
    <property name="targetMethod" value="run" /> 
    <property name="arguments"> 
     <null/> 
    </property> 
</bean> 

エラーが発生しています。

Error creating bean with name 'customJob' 
java.lang.NoSuchMethodException: total.scheduler.CustomExecutor.run() 

My CustomExecutorクラスメソッド。

public void run(Object object){ 
.... 
} 

答えて

2

てみてください以下のコード:

<bean id="customJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> 
    <property name="targetObject" ref="customExecutor" /> 
    <property name="targetMethod" value="run" /> 
    <property name="arguments"> 

    <property name="arguments"> 
     <list> 
      <null/> 
     </list> 
    </property> 
</bean> 
関連する問題