- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个要使用的自定义 Spring XD 源:
package com.my.springproject;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
public class MySource
{
@InboundChannelAdapter(value = "output",
poller = @Poller(fixedDelay = "5000", maxMessagesPerPoll = "1"))
public String next() {
return "foo";
}
}
现在的问题是,如何在我的 ModuleConfiguration.java 中注册它,以便 Spring XD 将其识别为有效源?到目前为止,我有这个,但是 Source 从来没有记录任何东西。
我的 ModuleConfiguration 看起来像这样:
package com.my.springproject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.messaging.MessageChannel;
@Configuration
@EnableIntegration
@ComponentScan( value = { "com.my.springproject" } )
public class ModuleConfiguration {
@Bean
MessageChannel output() {
return new DirectChannel();
}
@Bean
MySource source() {
return new MySource();
}
}
最佳答案
您必须使用 @MessageEndpoint
或仅使用 @Component
来标记您的 MySource
。
看起来我们有点过头了,在 MessagingAnnotationPostProcessor
中有这样的逻辑:
if (AnnotationUtils.findAnnotation(beanClass, Component.class) == null) {
// we only post-process stereotype components
return bean;
}
看起来有点奇怪不要只扫描 @Bean
上的消息传递注释。
欢迎就此事提出 JIRA( https://jira.spring.io/browse/INT ) 问题!
关于java - 如何为 Spring XD 配置 Spring InboundChannelAdapter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36454204/
我尝试定义一个 InboundChannelAdapter 来从队列 API(本例中为 Azure)读取消息。 native 方法如下所示: @Bean @InboundChannelAdap
我已经实现了Spring(启动)集成,我有一个InboundChannelAdapter,这个方法通过RestTemplate发送Web请求,并将结果传递给Splitter、Filter,最后到一个S
我正在尝试在 Spring 集成中实现自定义入站 channel 适配器以使用来自 apache kafka 的消息。基于 Spring 集成示例,我发现我需要创建一个实现 MessageSource
我有一个要使用的自定义 Spring XD 源: package com.my.springproject; import org.springframework.integration.
如何让 @InboundChannelAdapter 处理文件?像这样: 但是在java中呢? 最佳答案 像这样: @Bean @InboundChannelAdapter(va
我是一名优秀的程序员,十分优秀!