Spring 批次兼容性:spring-batch 2.2.7 与 spring-core 2.5.6

Spring Batch compatibility: spring-batch 2.2.7 with spring-core 2.5.6

我们最近开始在我们的应用程序中使用 spring 批处理来实现批处理。我们目前使用的 spring-core 是 2.5.6。但是,spring-batch 2.2.7 使用 spring-core 3.2.9。 我试图从 spring-batch 依赖项中排除 spring-core,spring-beans,但我仍然面临以下异常。我想知道 spring-batch 2.2.7 是否与 spring-core 2.5.6 一起使用?

Caused by: java.lang.NoClassDefFoundError: org/springframework/core/serializer/Serializer
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access0(Unknown Source)
        at java.net.URLClassLoader.run(Unknown Source)
        at java.net.URLClassLoader.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getDeclaredConstructors(Unknown Source)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determi
neCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:191)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineCon
structorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:859)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanIn
stance(AbstractAutowireCapableBeanFactory.java:831)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingleton
FactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:682)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFa
ctoryBean(AbstractAutowireCapableBeanFactory.java:614)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFac
tory.java:450)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(
DefaultListableBeanFactory.java:223)
        at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(Bea
nFactoryUtils.java:187)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidat
es(DefaultListableBeanFactory.java:652)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(De
faultListableBeanFactory.java:610)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$Autowir
edFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
        ... 18 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.serializer.Serializer
        at java.net.URLClassLoader.run(Unknown Source)
        at java.net.URLClassLoader.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

无法明确提及对 Spring 2.5 的支持,但参考指南提到了 Spring 2.5,因此我认为它支持它。

"The main difference is that the map keys in the example above do not need to be quoted with Spring 2.5, but the quotes are mandatory in Spring 3.0."