2011-03-30 35 views
7

我想能夠在我的web春季支持自動綁定中啓用SpringBeanAutowiringSupport的錯誤一個JAX-WS Web服務

public class MyService extends SpringBeanAutowiringSupport implements SomeInterface { 

private Dao dao; 

@Autowired 
public void setDao(Dao dao) { 
    this.dao = dao; 
} 

@WebService(endpointInterface = "SomeInterfacePath") 

但是註釋行通過爲MyService類以下,當我嘗試運行它,我得到一個

java.lang.NoSuchMethodError: org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext()Lorg/springframework/web/context/WebApplicationContext; 
at org.springframework.web.context.support.SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(SpringBeanAutowiringSupport.java:81) 
at org.springframework.web.context.support.SpringBeanAutowiringSupport.<init>(SpringBeanAutowiringSupport.java:68) 

錯誤,我一直沒能找到一個解決方案。我使用Spring 3.0 jar和apache-cxf。 Spring自動裝配在我​​的項目中的其他地方工作,但在這裏似乎不太好。關於發生了什麼的任何想法?我在我的appConfig中定義了一個jaxws端點

<jaxws:endpoint 
    id="myendpoint" 
    implementor="MyService" 
    address="/helloworld 
    /> 
+4

聞起來像一個春天的版本衝突對我。確保你只有Spring 3.0 JAR。檢查CXF JAR以確保沒有彈簧的副本隱藏在那裏。 – skaffman 2011-03-30 12:17:02

+0

謝謝,原來Spring框架jar的舊版本正在被使用,因此發生衝突。 – ShakeAndBake 2011-03-30 13:15:12

+2

這是一個好主意,將其作爲答案添加並接受,供網站的其他用戶查看。 – artbristol 2011-04-07 16:32:46

回答

1

直到最近,Apache CXF都將Spring 2.5.5作爲maven依賴項。 然而,CXF版本2.3及更高版本使用Spring 3

都包括<dependencymanagement>部分是關係到春指定的版本。