繁体   English   中英

如何在Mule Studio中向Java组件提供属性Bean?

[英]How to provide a property Bean to a Java Component in Mule Studio?

在Mule Studio 3.5中,直接在XML和Flow中,我具有以下声明:

<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>

这里解释。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM