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

   在一个业务类有下列属性

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

    public SchedulerFactory BeangetScheduler() {
        return scheduler;
    }

    public void setScheduler(SchedulerFactoryBean scheduler) {
        this.scheduler = scheduler;
    }
关于Failed to convert property value of type 
[org.quartz.impl.StdScheduler] to required type 
[org.springframework.scheduling.quartz.SchedulerFactoryBean

用spring 进行装配:

关于Failed to convert property value of type 
[org.quartz.impl.StdScheduler] to required type 
[org.springframework.scheduling.quartz.SchedulerFactoryBean
   <property name="scheduler">
           <ref bean="schedulerFactoryBean" />
        </property>

    </bean>
    <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"/>
关于Failed to convert property value of type 
[org.quartz.impl.StdScheduler] to required type 
[org.springframework.scheduling.quartz.SchedulerFactoryBean

启动时候报: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对象 ,

所以属性需要修改:

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

    public StdScheduler getScheduler() {
        return scheduler;
    }

    public void setScheduler(StdScheduler scheduler) {
        this.scheduler = scheduler;
    }
关于Failed to convert property value of type 
[org.quartz.impl.StdScheduler] to required type 
[org.springframework.scheduling.quartz.SchedulerFactoryBean

 

关于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

上一篇:php+curl解决爬虫绝对路径及相对路径的问题。


下一篇:spring中getSession()连接关闭的问题