如何将一个属性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
发布评论