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> 
+6
source share
2 answers
+3
source

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:

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

+2
source

Source: https://habr.com/ru/post/889520/


All Articles