2013-01-23 6 views
1

mule-config.xml에 몇 가지 흐름이 있지만 일부 콩은 하나의 흐름 만 말하는 것이 좋습니다. 플로우에 로컬 인 Bean을 정의하는 방법이 있습니까? 나는 인라인 콩 아래와 같이 정의 할 수 있음을 이해 :노새에서 로컬 스프링 빈을 정의하는 방법

<custom-transformer name="soapFaultTransformer" class="com.xxx.xx.transformer.VelocityMessageTransformer"> 
    <spring:property name="velocityEngine" ref="velocityEngine" /> 
    <spring:property name="templateName" value="soapFault.vm" /> 
    <spring:property name="beanClass"> 
     <spring:bean class="com.xxx.services.xx.Soap11Fault"> 
       <spring:property name="faultCode" value="Client" /> 
       <spring:property name="faultString" value="Invalid Request" /> 
       <spring:property name="detail"  value="..." /> 
     </spring:bean> 
    </spring:property> 
</custom-transformer> 

하지만 인라인 spring bean는 하나의 흐름이 개 장소에서 사용하는 것이 필요하다? 글로벌 빈을 만들지 않고도 한 곳에서 정의하고 2 곳에서 참조 할 수 있습니까?

는 당신에게 감사

+0

나는 그렇게 생각하지 않는다. 글로벌 콩의 문제점은 무엇입니까? –

+0

명시된 바와 같이,이 특정 콩은 단지 1 개의 흐름에 의미가 있으며, 다른 사람들에게 보이게 만드는 이유는 무엇입니까? _ 캡슐화 _ –

답변

1

@David가 말했듯이, 에 해당하는 bean을 단일 플로우로 선언 할 수는 없습니다. 선언 된 빈은 모든 플로우에서 사용할 수 있습니다.

1

어떻게 그 흐름 만 가져 별도의 스프링 설정 파일에 하나의 흐름에 필요한 모든 스프링 빈 수집에 대한?

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" 
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
    http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd "> 
    <spring:import resource="encapsulated-beans.xml" /> 

    <flow name="flow" > 
     ... 
    </flow> 


</mule> 

캡슐화-beans.xml 환경 예를 들어이 포함 된 설정 파일을 것입니다, 당신의 com.xxx.services.xx.Soap11Fault 콩 :

귀하의 노새 설정은 다음과 같이됩니다

+0

을 달성하려고 시도했습니다. 특정 흐름에 대한 스프링 파일을 가져 오는 예제를 제공하십시오. –

+0

는 설명에 따라 대답을 업데이트했습니다. – genjosanzo

+0

을 요청하면이 encapsulated-beans.xml을 모든 플로우에서 사용할 수 있습니까? 'flow' 흐름을 어떻게 구체화시킬 것인가? –

관련 문제