我必须为不同的端点调用外部服务。存在CCD_ 1网关。每个端点接受不同的数据,如CCD_ 2或CCD_。以下是生成/消耗xml
:的配置
<int-http:outbound-gateway
id="ca.outbound.gateway"
request-channel="ca.request.channel" url-expression="http://localhost:9988/current/acct/create"
http-method-expression="POST"
message-converters="Jaxb2RootElementHttpMessageConverter"
expected-response-type-expression="com.ds.Account"
charset="UTF-8" reply-timeout="5000" reply-channel="ca.reply.channel">
</int-http:outbound-gateway>
但是在启动应用程序时,会出现以下错误:APPLICATION FAILED TO START
A component required a bean named 'Jaxb2RootElementHttpMessageConverter' that could not be found.
Consider defining a bean named 'Jaxb2RootElementHttpMessageConverter' in your configuration.
注意:Jaxb2RootElementHttpMessageConverter
类存在于ClasspathSpring-web-5.0.5.RELEASE.jar
中。
我不知道如何解决这个错误。
这个错误清楚地表明你在这个问题上没有bean。类路径中有一个类,这并不意味着你会自动为它获得一个bean。你真的应该声明这样的东西:
<bean id="jaxb2RootElementHttpMessageConverter" class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/>
然后使用其CCD_ 10作为来自该CCD_。
请考虑了解更多关于Spring的信息:https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/core.html#spring-核心