在 Mule Studio 3.5 中,直接在 XML 和流中,我有以下声明:
<component class="fr.esb.bo.GenerateReportFileComponent" doc:name="BOreport">
<spring:property name="boServices" ref="boServices"/>
</component>
当我用这个启动 Mule 时,出现以下错误
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'spring:property'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor, "http://www.mulesoft.org/schema/mule/core":interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-entry-point-resolver-set, "http://www.mulesoft.org/schema/mule/core":abstract-entry-point-resolver, "http://www.mulesoft.org/schema/mule/core":abstract-object-factory, "http://www.mulesoft.org/schema/mule/core":abstract-lifecycle-adapter-factory, "http://www.mulesoft.org/schema/mule/core":binding}' is expected.
我明白了,但是我怎样才能将我的 boServices bean 提供给我的组件呢? 使用自定义转换器,效果很好。
最佳答案
将您的类定义为 Spring bean:
<spring:beans>
<spring:bean id="restaurantWaiter" scope="prototype" class="com.foo.RestaurantWaiter">
<spring:property name="kitchenService">
<spring:ref local="kitchenService"/>
</spring:property>
</spring:bean>
</spring:beans>
<component>
<spring-object bean="restaurantWaiter"/>
</component>
解释为 here .
关于java - 如何在 Mule Studio 中为 Java 组件提供属性 Bean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22534986/