Spring 集成:@ServiceActivator 不起作用

编程入门 行业动态 更新时间:2024-10-12 01:23:35
本文介绍了Spring 集成:@ServiceActivator 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下课程:

@Configuration public class SpringIntegrationTest { @Bean public SimpleWebServiceInboundGateway testInboundGateWay (){ SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway(); simpleWebServiceInboundGateway.setRequestChannelName("testChannel"); simpleWebServiceInboundGateway.setReplyChannelName("testChannel2"); return simpleWebServiceInboundGateway; } @Bean public MessageChannel testChannel() { return new DirectChannel(); } @Bean public MessageChannel testChannel2() { return new DirectChannel(); } @ServiceActivator(inputChannel = "testChannel", outputChannel = "testChannel2") public DOMSource foo(DOMSource request) { System.out.println("asd"); return request; } @Bean public EndpointMapping soapActionEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay ) { UriEndpointMapping uriEndpointMapping = new UriEndpointMapping(); uriEndpointMapping.setUsePath(true); uriEndpointMapping.setEndpointMap(createEndpointMapping(testInboundGateWay )); return uriEndpointMapping; } private Map<String, Object> createEndpointMapping(SimpleWebServiceInboundGateway testInboundGateWay ) { Map<String, Object> endpointMap = new HashMap<>(); endpointMap.put("/ws/test", testInboundGateWay ); return endpointMap; } }

即使服务激活器订阅了testChannel",我也会收到以下消息:

Even tough the service activator is subscribed for the "testChannel", I get the followin message:

o.s.i.w.SimpleWebServiceInboundGateway - 网关 sendAndReceive 发生故障:Dispatcher 没有频道org.springframework.web.context.WebApplicationContext:/MyProject restful API.testChannel"的订阅者.嵌套异常是 org.springframework.integration.MessageDispatchingException: Dispatcher has nosubscribes

o.s.i.w.SimpleWebServiceInboundGateway - failure occurred in gateway sendAndReceive: Dispatcher has no subscribers for channel 'org.springframework.web.context.WebApplicationContext:/MyProject restful API.testChannel'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers

我做错了什么?

推荐答案

您需要将 @EnableIntegration 添加到您的配置类之一.

You need to add @EnableIntegration to one of your configuration classes.

更多推荐

Spring 集成:@ServiceActivator 不起作用

本文发布于:2023-10-26 07:07:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529427.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   Spring   ServiceActivator

发布评论

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

>www.elefans.com

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