Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job scoped beans can not be injected into job scoped beans [BATCH-2337] #1259

Closed
spring-issuemaster opened this issue Jan 20, 2015 · 1 comment
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jan 20, 2015

Cihad Baskoy opened BATCH-2337 and commented

Job scoped beans can not be injected into job scoped beans. We have an XML configuration like

	<bean id="bondStaticPopulationFetcher" class="com.cs.emg.riskagg.bondstatic.refresh.BondStaticPopulationFetcher" scope="job" >
		<property name="bondHolder" ref="bondHolder" />
	</bean>

	<bean id="bondHolder" class="com.cs.emg.riskagg.bondstatic.refresh.BondHolder" scope="job" />

Then receive an error with

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.bondStaticPopulationFetcher' defined in class path resource [bond-static-beans.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.sun.proxy.$Proxy1 implementing org.springframework.aop.scope.ScopedObject,java.io.Serializable,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'com.refresh.BondHolder' for property 'bondHolder'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy1 implementing org.springframework.aop.scope.ScopedObject,java.io.Serializable,org.springframework.aop.framework.AopInfrastructureBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.refresh.BondHolder] for property 'bondHolder': no matching editors or conversion strategy found

Affects: 3.0.2

Reference URL: http://stackoverflow.com/questions/27381721/spring-batch-job-scoped-beans-can-not-be-injected-into-job-or-step-scope

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 20, 2015

Michael Minella commented

You're using java proxies but your class doesn't have an interface to proxy. You either need an interface (and code to it) or you need to switch to dynamic subclassing for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.