开发者

Spring 3 (SWS2): difference between <context:component-scan> and <sws:annotation-driven>

开发者 https://www.devze.com 2023-03-09 13:23 出处:网络
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.

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.

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.

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

<beans>
   <!-- works for all annotations e开发者_如何学Pythonxcept @Endpoint -->
    <sws:annotation-driven/>

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


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


For now use both as in:

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

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

this finds both @Endpoint and @PayloadRoot,@ResponsePayload annotations. This is the way they tell you to do it in Spring-WS reference:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消