CXF 3.3.5 配置client的神坑

邓尼茨我今天去赶集 2020年02月28日 1,505次浏览

xml文件里的xmlns与引入的jar包有关,要引入cxf client。

<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-client</artifactId>
            <version>3.3.5</version>
        </dependency>

3.3.5的xml的namespace和schemaLocation

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs-client" xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://cxf.apache.org/jaxrs-client
       http://cxf.apache.org/schemas/jaxrs-client.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

xml里的标签改为

<jaxrs:client></jaxrs:client>

而cxf 3.1.8里是

<jaxrsc:client></jaxrsc:client>

这也是个深坑。