我想创建一个内存jobrepository我得到这个异常,我知道为什么我会得到这个异常?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobExplorerInitial' defined in class path resource [fr/rsi/gdficoba/batch/integrationinitial/job/datasource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy22 implementing org.springframework.batch.core.repository.JobRepository,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean' for property 'repositoryFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy22 implementing org.springframework.batch.core.repository.JobRepository,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean] for property 'repositoryFactory': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
....
at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:290) [spring-batch-core-3.0.3.RELEASE.jar:3.0.3.RELEASE]
at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:590) [spring-batch-core-3.0.3.RELEASE.jar:3.0.3.RELEASE]
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy22 implementing org.springframework.batch.core.repository.JobRepository,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean' for property 'repositoryFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy22 implementing org.springframework.batch.core.repository.JobRepository,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean] for property 'repositoryFactory': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:474) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
..
... 13 common frames omitted
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy22 implementing org.springframework.batch.core.repository.JobRepository,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean] for property 'repositoryFactory': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 19 common frames omitted
我的配置
<bean id="repositoryFactory"
class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager" />
</bean>
<bean id="jobExplorerInitial" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean>
<property name="repositoryFactory" ref="repositoryFactory" />
</bean>
答案 0 :(得分:0)
您必须添加&#39;&amp;&#39;:
<property name="repositoryFactory" ref="&repositoryFactory"/>