首页 > 编程语言 > 详细

关于Failed to convert property value of type [org.quartz.impl.StdScheduler] to required type [org.springframework.scheduling.quartz.SchedulerFactoryBean

时间:2014-05-28 01:49:45      阅读:605      评论:0      收藏:0      [点我收藏+]

   在一个业务类有下列属性

bubuko.com,布布扣
private SchedulerFactoryBeanscheduler;

    public SchedulerFactory BeangetScheduler() {
        return scheduler;
    }

    public void setScheduler(SchedulerFactoryBean scheduler) {
        this.scheduler = scheduler;
    }
bubuko.com,布布扣

用spring 进行装配:

bubuko.com,布布扣
   <property name="scheduler">
           <ref bean="schedulerFactoryBean" />
        </property>

    </bean>
    <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"/>
bubuko.com,布布扣

启动时候报:Failed to convert property value of type [org.quartz.impl.StdScheduler] to required type [org.springframework.scheduling.quartz.SchedulerFactoryBean异常

解决方案:

SchedulerFactoryBean 这个bean
<bean id="Scheduler" lazy-init="false" autowire="no" 
class="org.springframework.scheduling.quartz.SchedulerFactoryBean" > 
</bean> 
它是一个工厂bean,得到的不是它本身,而是它负责创建的org.quartz.impl.StdScheduler对象 ,

所以属性需要修改:

bubuko.com,布布扣
   private StdScheduler scheduler;

    public StdScheduler getScheduler() {
        return scheduler;
    }

    public void setScheduler(StdScheduler scheduler) {
        this.scheduler = scheduler;
    }
bubuko.com,布布扣

 

关于Failed to convert property value of type [org.quartz.impl.StdScheduler] to required type [org.springframework.scheduling.quartz.SchedulerFactoryBean,布布扣,bubuko.com

关于Failed to convert property value of type [org.quartz.impl.StdScheduler] to required type [org.springframework.scheduling.quartz.SchedulerFactoryBean

原文:http://www.cnblogs.com/onmyway20xx/p/3753781.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!