使用CXF 2.7.11的workarround获取WS客户端以与Spring 4.2.0.RELEASE一起使用

时间:2018-07-04 10:37:26

标签: java spring jax-rs cxf

我正在尝试使用Spring(4.2.0.RELEASE)检索CXF(2.7.11)RS Web服务的客户端实例。

但是似乎此特定版本的CXF与该版本的Spring不兼容:我得到一个著名的例外:

java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.addConstructorArg

在我的application-context.xml中:我正在尝试按如下方式获取客户端:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:http- 
conf="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security" 
xmlns:jaxws="http://cxf.apache.org/jaxws" 
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/transports/http/configuration 
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/configuration/security 
http://cxf.apache.org/schemas/configuration/security.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

<!-- declare WS here as beans -->

<!-- -->
<!-- HTTP/S configuration for proxy & web clients -->
<!-- -->
<http-conf:conduit name="*.http-conduit">
    <http-conf:client ConnectionTimeout="3000000" ReceiveTimeout="3000000" />
    <http-conf:tlsClientParameters disableCNCheck="true">
    </http-conf:tlsClientParameters>
</http-conf:conduit>

    <bean id="jacksonProviderBooking" 
class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
    <bean id="queryOutInterceptor" 
class="com.europcar.mkt.customerfirst.v1.util.QueryOutInterceptor" />
    <bean id="loggingOutInterceptor" 
class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
    <bean id="loggingInInterceptor" 
class="org.apache.cxf.interceptor.LoggingInInterceptor" />



        <!-- Pooling WS -->
        <jaxrs:client id="eventBusClient" 
    serviceClass="com.europcar.it.eventbus.client.api.EventBusClient" 
    address="${polling.service.api.baseurl}">
        <jaxrs:headers>
            <entry key="Accept" value="application/json"/>
        </jaxrs:headers>
        <jaxrs:providers>
            <ref bean="jacksonProviderBooking"/>
        </jaxrs:providers>
        <jaxrs:outInterceptors>
            <ref bean="queryOutInterceptor"/>
            <ref bean="loggingOutInterceptor"/>
        </jaxrs:outInterceptors>
    </jaxrs:client>

    <!-- RES-res2 WS -->
    <!-- Cust-Repo -->
</beans>

还有其他方法可以获取此客户端实例吗?

0 个答案:

没有答案