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 文件的更多相关文章

  1. 配置 cxf-ws spring bean 文件

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  2. Spring Bean几种注入方式——setter(常用),构造器,注入内部Bean,注入集合,接口...

    依赖注入分为三种方式: 1.1构造器注入 构造器通过构造方法实现,构造方法有无参数都可以.在大部分情况下我们都是通过类的构造器来创建对象,Spring也可以采用反射机制通过构造器完成注入,这就是构造器 ...

  3. 【Spring】IoC容器 - Spring Bean作用域Scope(含SpringCloud中的RefreshScope )

    前言 上一章学习了[依赖来源],本章主要讨论SpringBean的作用域,我们这里讨论的Bean的作用域,很大程度都是默认只讨论依赖来源为[Spring BeanDefinition]的作用域,因为在 ...

  4. Spring配置bean文件的底层实现方式

    首先 bean文件如下: <beans> <bean id="date" class="java.util.Date"></bea ...

  5. Spring基础——在Spring Config 文件中配置 Bean

    一.基于 XML 的 Bean 的配置——通过全类名(反射) <bean <!-- id: bean 的名称在IOC容器内必须是唯一的若没有指定,则自动的将全限定类名作为 改 bean 的 ...

  6. Spring bean工厂配置头文件

    命名 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  7. CXF和spring整合遇到的问题:No bean named 'cxf' is defined

    今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...

  8. webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成

    首先到CXF官网及spring官网下载相关jar架包,这个不多说.webservice是干嘛用的也不多说. 入门例子 模拟新增一个用户,并返回新增结果,成功还是失败. 大概的目录如上,很简单. Res ...

  9. [原创]java WEB学习笔记98:Spring学习---Spring Bean配置及相关细节:如何在配置bean,Spring容器(BeanFactory,ApplicationContext),如何获取bean,属性赋值(属性注入,构造器注入),配置bean细节(字面值,包含特殊字符,引用bean,null值,集合属性list map propert),util 和p 命名空间

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

随机推荐

  1. Producer-consumer problem in Python

    from: http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ By : Akshar Raaj We will s ...

  2. python-股票数据定向爬取

    re.findall soup.find_all ---------Q---- for i in ***: ***可以是什么类型,主要是关心什么类型的不可以 ------------trackback ...

  3. IOS6新特性之下拉刷新<UIRefreshControl>

    在IOS6未发布之前,几乎都是使用那个UIRefresh在实现下拉刷新,甚至有人还是先了上拉的功能,不得不说牛人很多啊.可能是Apple意识到了这个功能的实用性,在IOS6中增加了下拉刷新,但是上啦还 ...

  4. node系列:全局与本地

    查看:默认和当前的 全局与本地 全局路径:npm config get prefix 本地路径:npm config get cache 修改 修改就会创建对应目录(文件夹) 修改本地路径:npm c ...

  5. Linux就业技术指导(一):简历撰写及面试筹备要领

    一,开场 二,模型 三,目标选材 3.1 什么是目标选材 简单说就是确定一个候选人是否符合某一个工作岗位要求的整个流程.这是对招聘方的一个培训,应聘方如果掌握了,就知道应该怎样正确的去应聘工作. 3. ...

  6. samtools 的应用

    1)sam转bam samtools view -bS in.sam > in.bam -b 意思使输出使BAM format -S 意思使输入使SAM,如果@SQ 缺剩, 要写-t

  7. CentOS 下安装 OpenOffice4.0

    一.更新服务器 yum源 [root@APP2 /]# yum clean all [root@APP2 /]# yum makecache [root@APP2 /]# yum update 1.首 ...

  8. Java连接MySQL数据库及操作

    Java操作MySQL数据库,需要驱动mysql-connector-java 来进行操作,去下载对应的jar包   一.导入需要的jar包 我用的是maven对包进行管理,在maven中添加如下内容 ...

  9. python之文件操作read

    #open函数,该函数用于文件处理,文件操作一共就有三种方法,打开文件#关闭文件, #先来说下打开文件,打开文件的模式有下面几种# 1.r,只读模式 f = open('test.log','r',e ...

  10. gridview 级联删除、dataset

    gridview编辑列(不使用控件绑定数据源)需要如下代码:<asp:GridView ID="GridView1" runat="server" Aut ...