春季3(SWS2):< context:component-scan>和< sws:annotation-driven> [英] Spring 3 (SWS2): difference between <context:component-scan> and <sws:annotation-driven>

查看:95
本文介绍了春季3(SWS2):< context:component-scan>和< sws:annotation-driven>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试一个仅带有一个@Endpoint注释类的简单Web Service Hello World示例时,使用<sws:annotation-driven/>命名空间时不会注册端点.

When trying a simple Web Service Hello World example with just one @Endpoint annotated class, the Endpoint is not registered when using the <sws:annotation-driven/> namespace.

但是,通过添加常规的<context:component-scan>,一切正常,可以正确注册Endpoint类. 这仅对于@Endpoint注释正确,所有其他注释(@RequestPayload@ResponsePayload@PayloadRoot)将按预期由sws-namespace注册.

However, by adding the usual <context:component-scan>, everything works well, the Endpoint-class is registered correctly. This is only true for the @Endpoint annotation, all other annotations (@RequestPayload, @ResponsePayload, @PayloadRoot) will be registered by the sws-namespace as expected.

该名称空间是否也不能处理@Endpoint批注?

Should the @Endpoint annotation not be processed by this namespace as well?

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

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

推荐答案

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

This is a known SWS bug: https://jira.springsource.org/browse/SWS-702.

这篇关于春季3(SWS2):&lt; context:component-scan&gt;和&lt; sws:annotation-driven&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆