1. 程式人生 > >cxf實體物件返回JSON格式

cxf實體物件返回JSON格式

<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>

<jaxrs:server id="customerService"  address="/sso">
   <jaxrs:serviceBeans>
      <bean class="com.weikaisen.controller.LoginController" />
   </jaxrs:serviceBeans>
   <jaxrs:providers>
<ref bean="jsonProvider"/> </jaxrs:providers> </jaxrs:server>
配置檔案中需加入 <jaxrs:providers> 才可以返回物件時自動轉換為JSON.