我正在尝试使用null参数调用自定义方法。我试图使用arguments属性与元素。但我收到了以下错误。有没有办法做到这一点?
<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()
我的CustomExecutor类方法;
public void run(Object object){
....
}
答案 0 :(得分: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>