我正在为JAX-WS使用Spring扩展,并且在Spring配置中使用列表时遇到问题:
这是工作配置:
<wss:binding url="/services/demo">
<wss:service>
<ws:service bean="#demoEndpoint">
<ws:handlers>
<ref bean="handler1"/>
<ref bean="handler2"/>
</ws:handlers>
</ws:service>
</wss:service>
</wss:binding>
由于我有更多的端点,它应该使用同一组处理程序,我想在一个配置中定义处理程序列表。
但是这个配置不起作用:
<util:list id="myHandlers">
<ref bean="handler1"/>
<ref bean="handler2"/>
</util:list>
<wss:binding url="/services/demo">
<wss:service>
<ws:service bean="#demoEndpoint">
<ws:handlers>
<ref bean="myHandlers"/>
</ws:handlers>
</ws:service>
</wss:service>
</wss:binding>
我得到以下异常:
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [javax.xml.ws.handler.Handler] for property 'handlers[0]': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264)
at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:559)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:199)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:448)
... 66 more
这是org.jvnet.jax_ws_commons.spring.SpringService中相应的setter:
public void setHandlers(List<Handler> handlers) {
this.handlers = handlers;
}