I Mule mit Frühlings-Integration bin mit SMS-Funktion implementieren zu senden, ist unten Frühjahr XML-Konfiguration:nicht mit unterschiedlichen Anwendungskontexten neu initialisieren kann
<?xml version="1.0" encoding="UTF-8"?>
<mule 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.7.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="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
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd">
<spring:beans>
<context:component-scan base-package="com.scholes.sf.message" />
<oxm:jaxb2-marshaller id="sfRequestMarshaller">
<oxm:class-to-be-bound name="com.scholes.sf.message.bean.SFSendSMSRequest" />
<oxm:class-to-be-bound name="com.scholes.sf.message.bean.SFVerifySMSRequest" />
</oxm:jaxb2-marshaller>
<!-- send SMS -->
<int:channel id="sendOobSmsResponseJsonChannel" />
<int:channel id="sendOobSmsResponseObjectChannelOOB" />
<int:channel id="sendOobSmsResponseObjectChannelSF" />
<int:channel id="sendOobSmsRequestChannel" />
<int:channel id="sendOobSmsResponseXmlChannel" />
<int:channel id="verifyOobSmsResponseXmlChannel" />
<int:channel id="verifyOobSmsRequestChannel" />
<int:channel id="verifyOobSmsResponseObjectChannelSF" />
<int:channel id="verifyOobSmsResponseObjectChannelOOB" />
<int:channel id="verifyOobSmsResponseJsonChannel" />
<int:object-to-json-transformer
input-channel="sendOobSmsResponseObjectChannelOOB" output-channel="sendOobSmsResponseJsonChannel">
</int:object-to-json-transformer>
<int:transformer input-channel="sendOobSmsResponseObjectChannelSF"
output-channel="sendOobSmsResponseObjectChannelOOB" ref="oobSendSMSTransformer" />
<int:transformer input-channel="sendOobSmsResponseXmlChannel"
output-channel="sendOobSmsResponseObjectChannelSF" ref="sfSendResponseUnmarshaller" />
<int:transformer input-channel="sendOobSmsRequestChannel"
output-channel="sendOobSmsResponseXmlChannel" ref="sfSendSmsTransformer" />
<spring:bean id="sfSendSmsTransformer" class="com.scholes.sf.message.transformer.SFSendSMSTransformer" />
<int:channel id="sendOobSmsResponseObjectChannel" />
<spring:bean id="sfSendResponseUnmarshaller"
class="org.springframework.integration.xml.transformer.UnmarshallingTransformer">
<spring:constructor-arg>
<oxm:jaxb2-marshaller id="sfSendRequestMarshaller">
<oxm:class-to-be-bound name="com.scholes.sf.message.bean.SFSendSMSResponse" />
</oxm:jaxb2-marshaller>
</spring:constructor-arg>
</spring:bean>
<spring:bean id="oobSendSMSTransformer" class="com.scholes.sf.message.transformer.OOBSendSMSTransformer" />
<!-- verify SMS -->
<int:transformer input-channel="verifyOobSmsRequestChannel"
output-channel="verifyOobSmsResponseXmlChannel" ref="sfVerifySmsTransformer" />
<spring:bean id="sfVerifySmsTransformer" class="com.scholes.sf.message.transformer.SFVerifySMSTransformer" />
<int:channel id="verifyOobSmsResponseObjectChannel" />
<spring:bean id="sfVerifyResponseUnmarshaller"
class="org.springframework.integration.xml.transformer.UnmarshallingTransformer">
<spring:constructor-arg>
<oxm:jaxb2-marshaller id="sfVerifyRequestMarshaller">
<oxm:class-to-be-bound name="com.scholes.sf.message.bean.SFVerifySMSResponse" />
</oxm:jaxb2-marshaller>
</spring:constructor-arg>
</spring:bean>
<int:transformer input-channel="verifyOobSmsResponseXmlChannel"
output-channel="verifyOobSmsResponseObjectChannelSF" ref="sfVerifyResponseUnmarshaller" />
<int:transformer input-channel="verifyOobSmsResponseObjectChannelSF"
output-channel="verifyOobSmsResponseObjectChannelOOB" ref="oobVerifySMSTransformer" />
<spring:bean id="oobVerifySMSTransformer" class="com.scholes.sf.message.transformer.OOBVerifySMSTransformer" />
<int:object-to-json-transformer
input-channel="verifyOobSmsResponseObjectChannelOOB" output-channel="verifyOobSmsResponseJsonChannel">
</int:object-to-json-transformer>
<context:property-placeholder location="sms/oob-config.properties"/>
</spring:beans>
</mule>
Es scheint, versuchen, einen zweiten Feder-Integration Kontext zu initialisieren, so unten bekommen Fehler:
WARN 2016-03-22 17:21:37,388 [main] org.mule.config.spring.MuleArtifactContext: Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'integrationRequestMappingHandlerMapping': Initialization of bean failed; nested exception is org.springframework.context.ApplicationContextException: Cannot reinitialize with different application context: current one is [[email protected]: startup date [Tue Mar 22 17:21:29 CST 2016]; root of context hierarchy], passed-in one is [[email protected]: startup date [Tue Mar 22 17:21:33 CST 2016]; parent: [email protected]] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:753) ~[mule-module-spring-config-3.7.2.jar:4.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE] at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:108) ~[mule-module-spring-config-3.7.2.jar:3.7.2]
Jeder Master kann helfen, dieses Problem zu analysieren? Wenn ich diesen XML-Code nicht einschließe, ist alles in Ordnung. Wie können SI und Spring zusammenarbeiten?
Jetzt lade ich nur programmatisch die si-config.xml in meiner Java-Quelle, um dieses Problem zu beheben. –