Spring 3 (SWS2): difference between <context: component-scan> and <sws: annotation-driven>
If you try a simple Hello World Web Service example with an annotated @Endpoint class @Endpoint endpoint is not registered when using the <sws:annotation-driven/> namespace.
However, adding the usual <context:component-scan> , everything works well, the Endpoint class is registered correctly. This is true only for the @Endpoint annotation, all other annotations ( @RequestPayload , @ResponsePayload , @PayloadRoot ) will be registered in the sws namespace as expected.
If the @Endpoint annotation @Endpoint not processed by this namespace?
<beans> <!-- works for all annotations except @Endpoint --> <sws:annotation-driven/> <!-- when activated, @Endpoint is registered correctly <context:component-scan/> --> </beans> Now use both parameters:
<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 how they tell you to do this in Spring -WS: