Wednesday, 15 September 2010

java - Spring Integration http endpoint from child context doesen't work -



java - Spring Integration http endpoint from child context doesen't work -

when configure http inbound channel adapter in root context works:

<int-http:inbound-channel-adapter id="httpinbount" path="test" channel="ch.http.in" /> <int:channel id="ch.http.in" /> <int:service-activator input-channel="ch.http.in" output-channel="ch.aggr.obj" ref="httptoobjtransformer" method="transform"></int:service-activator> <bean id="httptoobjtransformer" class="com.nevexis.dcard.integration.transformer.httptoobjtransformer" /> <int:channel id="ch.aggr.obj"> <int:queue /> </int:channel>

but when load kid context it's not registered.

<int:channel id="ch.aggr.obj"> <int:queue /> </int:channel>

is in root context , load

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:int="http://www.springframework.org/schema/integration" xmlns:int-http="http://www.springframework.org/schema/integration/http" xsi:schemalocation="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/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <int-http:inbound-channel-adapter id="httpinbount" path="transaction" channel="ch.http.in" /> <int:channel id="ch.http.in" /> <int:service-activator input-channel="ch.http.in" output-channel="ch.aggr.obj" ref="httptoobjtransformer" method="transform"></int:service-activator> <bean id="httptoobjtransformer" class="com.nevexis.dcard.integration.transformer.httptoobjtransformer" /> </beans>

as kid genericxmlapplicationcontext.

when kid context laoded can see

integrationrequestmappinghandlermapping:197 - mapped "{[/transaction],methods=[get || post],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public abstract void org.springframework.web.httprequesthandler.handlerequest(javax.servlet.http.httpservletrequest,javax.servlet.http.httpservletresponse) throws javax.servlet.servletexception,java.io.ioexception

in log, http://localhost:8081/transaction can't mapped.

that's because dispatcherservlet defined in separete kid context , doesn't see integrationrequestmappinghandlermapping bean.

any kid context can see beans ancestors, not other kid context parent context can't see bean in children.

there need understand why want declare integration flow in kid context. why isn't <context:import> plenty you?

java spring spring-integration

No comments:

Post a Comment