Friday, February 13, 2009

Spring ref vs. bean: no ID/IDREF binding for IDREF

hen upgrading a project from Mule 1.x to Mule 2.x, I ran into the following error while converting my Mule configuration file:
A Fatal error has occurred while the server was running:
cvc-id.1: There is no ID/IDREF binding for IDREF 'someProxy'.
(org.xml.sax.SAXParseException)
The offending bean:
   <spring:bean id="myImplementationBean" class="org.my.class" scope="prototype">
<spring:property name="myInterface">
<spring:ref local="myProxy"/>
</spring:property>
</spring:bean>
The problem was using local instead of bean as the value of the spring:property:
   <spring:bean id="myImplementationBean" class="org.my.class" scope="prototype">
<spring:property name="myInterface">
<spring:ref bean="myProxy"/>
</spring:property>
</spring:bean>
For a discussion the difference, see Spring-ref-local-vs-ref.

No comments:

Post a Comment