Hello!

I have struck a wall in my implementation and I do not know how to resolve this.

I have a CustomItemWriter, that is creating StaxEventItemWriters on the fly from a prototype. That worked really well for a long time now, but I now need to extend this implementation.

I set up another Item Writer which gets this CustumItemWriter injected as the class not the itemWriter Interface, because I need to be able to set CallBacks for some of these StaxItemWriters and setting Callbacks has no interface.

To add to the problem my CustomItemWriter is Step-Scoped.....

I tried and failed to find a way to get around the "Failed to convert property value of type '$Proxy...." error, but so far nothing worked.

Is there any way I can work around this limitation?

Code:
    <bean id="itemWriter" class="some.pckg.writer.UpperDelegatingItemWriter" scope="step" > <!-- this one sets the callbacks on the delegate after retrieving the target itemWriters name -->
        <property name="delegateWriter" ref="customCompositeItemWriter" />
        <property name="writerCallbackPrototypeName" value="myStaxWriterCallback" />
    </bean>

    <bean id="customCompositeItemWriter" class="some.pckg.writer.CardProgramCompositeItemWriter" scope="step"> <!-- this one creates the itemWriters on the fly after receiving some data, that helps deciding if it needs to create a new writer or uses one of the already exisisting ones.-->
        <property name="itemWriterPrototypeName" value="documentItemWriter" />
        <property name="outputDirectory" value="${output.directory}" />
    </bean>

    <bean id="documentItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="prototype">
        <property name="marshaller" ref="myMarshaller" />
        <property name="rootTagName" value="........" />
        <property name="overwriteOutput" value="true" />
        <property name="saveState" value="false" />
        <property name="encoding" value="UTF-8" />
        <property name="version" value="1.0" />
        <property name="transactional" value="false" />
    </bean>

   <bean id="myStaxWriterCallback" class="some.pckg.writer.SummaryStaxWriterCallback" scope="prototype">
        <property name="marshaller" ref="myMarshaller" />
    </bean>
UpperDelegatingItemWriter calls setStaxWriterCallBack(...) and the write method on
CustomCompositeItemWriter :
Code:
	public void setStaxWriterCallBack(String filename, StaxWriterCallback callback) {
		StaxEventItemWriter<Document> delegate = this.staxEventItemWriters.get(filename);
		if(delegate != null) {
			delegate.setFooterCallback(callback);
		}
	}
Any help is highly appreciated. I am at a loss here right now.

Thanks.

Yours, Y.