我正在使用Apache CXF版本2.4.0.我正在尝试创建一个Restful服务.
以下示例适用于2.3.4,但在2.4.0中不起作用.我应该在beans配置文件中做些什么?
当我在我的bean配置文件中包含下面的xml行时.
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
Run Code Online (Sandbox Code Playgroud)
我收到以下stacktrace错误:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法从URL位置导入bean定义[classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml]
违规资源:ServletContext资源[/WEB-INF/beans.xml]; 嵌套异常是org.springframework.beans.factory.BeanDefinitionStoreException:
IOException从类路径资源解析XML文档[META-INF/cxf/cxf-extension-jaxrs-binding.xml]; 嵌套异常是java.io.FileNotFoundException:无法打开类路径资源[META-INF/cxf/cxf-extension-jaxrs-binding.xml],因为它在org.springframework.beans.factory.parsing.FailFastProblemReporter中不存在.错误(FailFastProblemReporter.java:68)
我的POM依赖关系如下.这适用于2.3.4但不适用于2.4.0.有什么建议?该xml扩展行是否已弃用或包含在另一个jar中?
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.3.4</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud) 我是任何开放框架的新手(我是基于java的解决方案工程师)并试图构建一个cxf项目.
我知道我需要有applicationContext.xml类似的文件和内容
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<http-conf:conduit name="*.http-conduit">
<http-conf:client ReceiveTimeout=“300000“ AllowChunking="false"/>
</http-conf:conduit>
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>
</beans>
Run Code Online (Sandbox Code Playgroud)
在里面.
我现在想知道我可以在哪里下载
cxf/cxf.xml, cxf-extension-soap.xml, cxf-servlet.xml文件.
或者我创建动态Web项目是错误的?是否有其他项目类型会自动生成这些文件?