如何将一个属性Bean提供给Mule Studio中的Java组件?(How to provide a property Bean to a Java Component in Mule Studio

编程入门 行业动态 更新时间:2024-10-23 11:29:44
如何将一个属性Bean提供给Mule Studio中的Java组件?(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提供给我的组件? 通过定制变压器,这种方式运行良好。

In Mule Studio 3.5, directly in the XML and in a Flow, I have the following declaration :

<component class="fr.esb.bo.GenerateReportFileComponent" doc:name="BOreport"> <spring:property name="boServices" ref="boServices"/> </component>

When I launch Mule with this, I get the following error

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.

I understand that, but how can I provide my boServices bean to my component ? With a custom-transformer, this is working well.

最满意答案

将您的类定义为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>

如这里所解释的。

Define your class as a 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>

as explained here.

更多推荐

org,Mule,boServices,电脑培训,计算机培训,IT培训"/> <meta name="descripti

本文发布于:2023-08-06 21:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1454987.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:提供给   如何将   组件   属性   Bean

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!