Spring Cloud Stream 3.0.7测试逻辑

问题描述

作为Spring的新手,但具有流处理的背景,我对应该如何测试用Spring Cloud Stream编写的处理器感到非常困惑。测试docs(为2.2.0编写,但似乎是最新的,因此对于3.0.7仍然有效吗?)表明应该通过注释将处理器自动连接到测试类中,但是没有提到在哪里这个“处理器” bean来自。我试图通过以下方式使其可用:

import org.springframework.cloud.stream.messaging.Processor;
...

@Autowired
private Processor processor;

但是运行测试时,例外始终是相同的:

Unsatisfied dependency expressed through field 'processor'; nested exception is org.springframework.beans.factory.NoSuchBeanDeFinitionException: No qualifying bean of type 'org.springframework.cloud.stream.messaging.Processor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

在这里甚至在正确的道路上吗?在过去的一年中似乎有很多不推荐使用的功能,因此希望获得指向最新文档的任何指示。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)