Apache CXF框架的單元測試需要內置Jetty容器
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
下面是一個基於Spring框架的Apache CXF測試示例
applicationContext-restful.xml
<import resource="classpath:META-INF/cxf/cxf.xml"