2011-06-01 62 views
6

僅當使用一個@Endpoint註釋類嘗試簡單的Web Service Hello World示例時,Endpoint未使用<sws:annotation-driven/>命名空間。Spring 3(SWS2):<context:component-scan>和<sws:annotation-driven>之間的差異

但是,通過添加通常的<context:component-scan>,一切正常,端點類正確註冊。 這僅適用於@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> 
+0

你能告訴我地址​​,以這個例子嗎?我很難找到好的Spring WS 2教程。 – Jaanus 2011-09-27 16:04:40

回答

3

這是一個已知的SWS錯誤:https://jira.springsource.org/browse/SWS-702

+0

我看到了這個bug報告,但是Arjen對19/5月的評論似乎表明了另一個bug - 我的端點沒有實現任何接口,也沒有使用aop-proxies(至少有意)。 – Ice09 2011-06-01 14:24:07

2

現在既作爲在:

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

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

此同時找到@Endpoint和@ PayloadRoot,@ ResponsePayload註解。 這是他們告訴你做它在春天-WS參考方式:

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

+0

的確如此,但有人說:...我們還指示Spring-WS使用註釋驅動的端點和元素...所以我明白上下文:cmp-scan只用於用於在sws域外「註冊」組件。 – Ice09 2011-06-01 14:28:43

+0

那麼這是一個錯誤還是通過設計?我有同樣的問題,這個答案可以解決它。 Pivotal在Spring文檔中的例子就是這樣。 [見5.4。端點部分](http://docs.spring.io/spring-ws/site/reference/html/server.html) – gaoagong 2014-08-04 17:45:31

+0

,你能解釋一下這個marhaller的設置嗎? – hudi 2014-08-08 10:41:39

相關問題