配置 cxf-rs spring bean 文件
http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/docs/restful-services.html
示例:
<?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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml" /> <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider" />
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> <cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus> <jaxrs:server id="services" address="/">
<jaxrs:serviceBeans>
<bean class="cn.zno.HelloWorld" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jsonProvider" />
<ref bean="jaxbProvider" />
</jaxrs:providers>
<jaxrs:extensionMappings>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
</jaxrs:extensionMappings>
<jaxrs:languageMappings>
<entry key="en" value="en-gb" />
</jaxrs:languageMappings>
</jaxrs:server>
</beans>
没有endpoint
<xsd:element name="server">...</xsd:element>
<xsd:element name="client">...</xsd:element>
jaxrs:server
<xsd:attributeGroup ref="cxf-beans:beanAttributes"/>
<xsd:attribute name="address" type="xsd:string"/>
<xsd:attribute name="bus" type="xsd:string"/>
<xsd:attribute name="serviceClass" type="xsd:string"/>
<xsd:attribute name="transportId" type="xsd:string"/>
<xsd:attribute name="modelRef" type="xsd:string"/>
<xsd:attribute name="bindingId" type="xsd:string"/>
<xsd:attribute name="staticSubresourceResolution" type="xsd:boolean"/>
<xsd:attribute name="beanNames" type="xsd:string"/>
<xsd:attribute name="serviceName" type="xsd:QName"/>
<xsd:attribute name="docLocation" type="xsd:string"/>
<xsd:attribute name="publishedEndpointUrl" type="xsd:string"/>
<xsd:attribute name="basePackages" type="xsd:string"/>
<xsd:attribute name="serviceAnnotation" type="xsd:string"/>
<xsd:attribute name="publish" type="xsd:boolean"/>
<xsd:all>
<xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="features" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="dataBinding" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="serviceFactories" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
<xsd:element name="serviceBeans" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="modelBeans" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="model" type="model" minOccurs="0"/>
<xsd:element name="providers" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="extensionMappings" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="languageMappings" type="xsd:anyType" minOccurs="0"/>
<xsd:element name="schemaLocations" type="schemasType" minOccurs="0"/>
<xsd:element name="resourceComparator" type="xsd:anyType" minOccurs="0"/>
</xsd:all>
开启日志
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus> 增加后,请求时,增加如下日志:
七月 , :: 下午 org.apache.cxf.interceptor.LoggingInInterceptor
信息: Inbound Message
----------------------------
ID:
Address: http://localhost:8080/cxf-jaxrs-service/hello/jsonBean
Encoding: ISO--
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[application/json], cache-control=[no-cache], connection=[keep-alive], Content-Length=[], content-type=[application/json], host=[localhost:], pragma=[no-cache], user-agent=[Apache CXF 3.1.]}
Payload: {"val2":null,"val1":"Maple"}
--------------------------------------
七月 , :: 下午 org.apache.cxf.interceptor.LoggingOutInterceptor
信息: Outbound Message
---------------------------
ID:
Response-Code:
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Thu, Jul :: GMT]}
Payload: {"val2":"Maple","val1":"Maple"}
--------------------------------------
效果等同于:
<bean id="inInterceptors" class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
<bean id="outInterceptors" class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
[...]
<jaxrs:inInterceptors>
<ref bean="inInterceptors" />
</jaxrs:inInterceptors>
<jaxrs:outInterceptors>
<ref bean="outInterceptors" />
</jaxrs:outInterceptors>
权限验证
http://cxf.apache.org/docs/security.html
配置 cxf-rs spring bean 文件的更多相关文章
- 配置 cxf-ws spring bean 文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- Spring Bean几种注入方式——setter(常用),构造器,注入内部Bean,注入集合,接口...
依赖注入分为三种方式: 1.1构造器注入 构造器通过构造方法实现,构造方法有无参数都可以.在大部分情况下我们都是通过类的构造器来创建对象,Spring也可以采用反射机制通过构造器完成注入,这就是构造器 ...
- 【Spring】IoC容器 - Spring Bean作用域Scope(含SpringCloud中的RefreshScope )
前言 上一章学习了[依赖来源],本章主要讨论SpringBean的作用域,我们这里讨论的Bean的作用域,很大程度都是默认只讨论依赖来源为[Spring BeanDefinition]的作用域,因为在 ...
- Spring配置bean文件的底层实现方式
首先 bean文件如下: <beans> <bean id="date" class="java.util.Date"></bea ...
- Spring基础——在Spring Config 文件中配置 Bean
一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...
- Spring bean工厂配置头文件
命名 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...
- CXF和spring整合遇到的问题:No bean named 'cxf' is defined
今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...
- webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成
首先到CXF官网及spring官网下载相关jar架包,这个不多说.webservice是干嘛用的也不多说. 入门例子 模拟新增一个用户,并返回新增结果,成功还是失败. 大概的目录如上,很简单. Res ...
- [原创]java WEB学习笔记98:Spring学习---Spring Bean配置及相关细节:如何在配置bean,Spring容器(BeanFactory,ApplicationContext),如何获取bean,属性赋值(属性注入,构造器注入),配置bean细节(字面值,包含特殊字符,引用bean,null值,集合属性list map propert),util 和p 命名空间
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
随机推荐
- js执行机制(1)
1.参考执行结果 setTimeout(function () { console.log('执行定时任务'); }); new Promise(function (resolve) { consol ...
- H5特性回顾
canvas 绘画, video 媒介回放 audio元素 对本地离线存储的更好支持, 新的特殊内容 - 元素 比如 article,footer,header,nav,section, 新的表单控件 ...
- Gulp的安装与配置
http://blog.csdn.net/itlsx/article/details/49981459
- 关于frameset与iframe的使用
<frameset>与<body>标签同级,是不能同时存在的,<frameset>是把当前页面进行分割. frameset.html: <!DOCTYPE h ...
- memory management
1. 高端内存: 内存的物理寻址范围比虚拟寻址范围大的多,有一些内存页不能永久的映射到内核地址空间. 2. 高端内存和低端内存是内核对内存物理页的划分. 参考:http://ilinuxkernel. ...
- maven package install deploy
1.maven package:打包到本项目,一般是在项目target目录下. 如果a项目依赖于b项目,打包b项目时,只会打包到b项目下target下,编译a项目时就会报错,因为找不到所依赖的b项目, ...
- 执行js,通过js显示隐藏的输入框,或者给input赋值
在测试过程中,有些输入框是隐藏的,如果直接对他进行赋值,会找不到这个输入框,从而导致脚本运行失败. 例如下面的这个密码输入框: 登录密码输入框分为两个input,下面的是提示的,上面的才是真正存下来的 ...
- ios 处理WKContentView的crash
http://www.jianshu.com/p/7ef5814a871b 解决WKContentView没有isSecureTextEntry方法造成的crash 程序中有web页面,使用W ...
- python的进程间的数据交互
#先来看下如何实现多进程 # multiprocessing 这个是python的多进程的模块,我们会用到这个模块的很多方法 from multiprocessing import Process i ...
- 300最长上升子序列 · Longest Increasing Subsequence
[抄题]: 往上走台阶 最长上升子序列问题是在一个无序的给定序列中找到一个尽可能长的由低到高排列的子序列,这种子序列不一定是连续的或者唯一的. 样例 给出 [5,4,1,2,3],LIS 是 [1,2 ...