【问题标题】:Spring 3 (SWS2): difference between <context:component-scan> and <sws:annotation-driven>Spring 3 (SWS2):<context:component-scan> 和 <sws:annotation-driven> 的区别
【发布时间】:2011-06-01 09:00:13
【问题描述】:

当尝试一个简单的 Web 服务 Hello World 示例时,只有一个 @Endpoint 注释类,使用 &lt;sws:annotation-driven/&gt; 命名空间时未注册端点。

但是,通过添加通常的&lt;context:component-scan&gt;,一切正常,端点类注册正确。 这仅适用于 @Endpoint 注释,所有其他注释(@RequestPayload@ResponsePayload@PayloadRoot)将按预期由 sws 命名空间注册。

@Endpoint 注解是否也应该不被这个命名空间处理?

<beans>
   <!-- works for all annotations except @Endpoint -->
    <sws:annotation-driven/>

    <!-- when activated, @Endpoint is registered correctly <context:component-scan/> -->
</beans>

【问题讨论】:

  • 你能告诉我这个例子的地址吗?我很难找到好的 Spring WS 2 教程。

标签: spring spring-ws


【解决方案1】:

这是一个已知的 SWS 错误:https://jira.springsource.org/browse/SWS-702

【讨论】:

  • 我看到了这个错误报告,但 Arjen 在 5 月 19 日的评论在我看来表明了另一个错误——我的端点没有实现任何接口,我也没有使用 aop-proxies(至少是故意的)。
【解决方案2】:

现在两者都使用:

<context:component-scan base-package="com.coral.project.endpoints"/>

<sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>

这会找到@Endpoint 和@PayloadRoot,@ResponsePayload 注释。 这是他们在 Spring-WS 参考中告诉您这样做的方式:

http://static.springsource.org/spring-ws/sites/2.0/reference/html/tutorial.html#tutorial.implementing.endpoint

【讨论】:

猜你喜欢
  • 2012-11-19
  • 1970-01-01
  • 1970-01-01
  • 2011-10-04
  • 2011-11-16
  • 1970-01-01
  • 2017-03-19
  • 2014-04-11
相关资源
最近更新 更多