[英]Spring boot integration - ref not recognizing bean for adapter
我正在尝试使用 spring 集成构建一个 spring boot 项目,以使用自定义入站通道适配器处理传入的 as2 消息。 由于某种原因,适配器的 ref 参数没有为我的类找到 bean 定义。
我有以下spring参考文件和网上资源,有以下理解:
添加指向我的 spring 集成 xml 文件的@ImportResource("\/integration\/integration.xml")<\/code>注释将其添加到应用程序上下文
<\/li><\/ol>
在我的类上方添加@Component<\/code>注释应该使它可以被我的 Spring Boot 应用程序自动检测为 bean
<\/li><\/ol> @Component public class MyHandlerModule extends AbstractProcessorModule implements IProcessorStorageModule { private static final Logger LOGGER = LoggerFactory.getLogger(MyHandlerModule.class); @Override public boolean canHandle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) { LOGGER.info(" Handle Info:" + s); LOGGER.info(map.toString()); return s.equals(DO_STORE); } @SneakyThrows @Override public void handle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) { LOGGER.info("----- AS2 MESSAGE RECEIVED !!! ------"); } }<\/code><\/pre>
-
但是在我的integration.xml<\/code>文件中运行应用程序时出现错误,并显示以下消息:
<\/li><\/ol> A component required a bean named 'com.example.MyHandlerModule' that could not be found.<\/code><\/pre> 作为参考,这是我的integration.xml<\/code>文件:
有什么我想念的吗?"
错误是正确的:没有任何自定义名称,框架使它像
myHandlerModule<\/code> - 基于 BBC 的骆驼案例一个简单的类名。
该包不涉及 bean 命名。 不确定是什么让您在该参考文献中指向完全限定的类名......
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.