从 Spring 3 迁移到 Spring 4 - org.springframework.scheduling.quartz.CronTriggerBean

Migrating from Spring 3 to Spring 4 - org.springframework.scheduling.quartz.CronTriggerBean

我正在尝试从 spring 3.0.5 迁移到 spring 4.1.X .

Spring 3 有 Class 命名为 "org.springframework.scheduling.quartz.CronTriggerBean"

但是 Spring 4 不包括这个 class 名称。

[5/28/15 20:10:16:798 EDT] 00000092 ClassPathXmlA W org.springframework.context.support.AbstractApplicationContext __refresh Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.CronTriggerBean] for bean with name 'beanIdName' defined in class path resource [config/spring/WxsCacheContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.CronTriggerBean at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1328)

我已经尝试过像 "spring-support" 这样的替代方法,它具有相同的 class。但运气不好。

拿到那个罐子后,它给出了关于石英的错误

[5/28/15 15:37:02:665 EDT] 0000006e SystemOut O ERROR (?:?) - java.lang.Exception: Bean from SpringUtils.getSpringBean(hostnameVerifierSetter) error message: Unable to initialize group definition. Group resource name [classpath*:beanRefFactory.xml], factory key [beanContext]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanContext' defined in URL [file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/cellName/Project.ear/configurations/beanRefFactory.xml]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.quartz.impl.JobDetailImpl

从 Spring 3.1+,更改 Class CronTriggerFactoryBean 和 JobDetailFactoryBean 的名称,如下所示

   org.springframework.scheduling.quartz.CronTriggerBean 
                               org.springframework.scheduling.quartz.CronTriggerFactoryBean
   org.springframework.scheduling.quartz.JobDetailBean
                               org.springframework.scheduling.quartz.JobDetailFactoryBean

所以你的步骤是:

改变

CronTriggerBean to CronTriggerFactoryBean
JobDetailBean to JobDetailFactoryBean

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/quartz/CronTriggerFactoryBean.html

从Spring3.1开始,变了