<bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<!--shouldRecover属性为true,则当Quartz服务被中止后,再次启动任务时会尝试恢复执行之前未完成的所有任务-->
<property name="jobClass">
<value>com.richway.quartz.test.HelloWorld</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="simpleService">
<ref bean="simpleService" />
</entry>
</map>
</property>
</bean>
这里面的simpleService明明已经实现了serializable接口,可是后台为啥还报错:
Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory]springquartz
<!--shouldRecover属性为true,则当Quartz服务被中止后,再次启动任务时会尝试恢复执行之前未完成的所有任务-->
<property name="jobClass">
<value>com.richway.quartz.test.HelloWorld</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="simpleService">
<ref bean="simpleService" />
</entry>
</map>
</property>
</bean>
这里面的simpleService明明已经实现了serializable接口,可是后台为啥还报错:
Couldn't store job: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory [See nested exception: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'simpleService' is not serializable: org.springframework.beans.factory.support.DefaultListableBeanFactory]springquartz
import java.util.Date;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class SimpleService implements Serializable{ /**
*
*/
private static final long serialVersionUID = 1319673450675993416L;
/**
*
*/
private static Log logger = LogFactory.getLog(SimpleService.class);//日志记录器
public void testMethod(String name){
//这里执行定时调度业务
logger.info("当前时间:"+new Date());
}
public void testMethod2(){
logger.info("testMethod2");
} }
org.springframework.beans.factory.support.DefaultListableBeanFactory