title: Preferred Semantics for CXF JAX-RS
body: <p>I was wondering what the preferred semantics are for <code>jaxrs:server</code> configurations in a CXF XML context file. </p>
  
  <p>For example, if I have two service implementations for users and orders, and they're accessible from a relative path <code>"/user"</code> and <code>"/order"</code>. </p>
  
  <p>Would I configure the services this way:</p>
  
  <pre><code>&lt;jaxrs:server id="userService" address="/user"&gt;
      &lt;jaxrs:serviceBeans&gt;
          &lt;bean class="com.example.UserServiceImpl /&gt;
      &lt;/jaxrs:serviceBeans&gt;
      &lt;jaxrs:providers&gt;
          &lt;bean class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" /&gt;
      &lt;/jaxrs:providers&gt;
  &lt;/jaxrs:server&gt;
  
  &lt;jaxrs:server id="orderService" address="/order"&gt;
      &lt;jaxrs:serviceBeans&gt;
          &lt;bean class="com.example.OrderServiceImpl /&gt;
      &lt;/jaxrs:serviceBeans&gt;
      &lt;jaxrs:providers&gt;
          &lt;bean class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" /&gt;
      &lt;/jaxrs:providers&gt;
  &lt;/jaxrs:server&gt;
  </code></pre>
  
  <p>Or this way:</p>
  
  <pre><code>&lt;jaxrs:server id="appService" address="/"&gt;
      &lt;jaxrs:serviceBeans&gt;
          &lt;!-- 
              Path configured using @Path annotations on the class definition:
  
              @Path(value="/user")
              public class UserServiceImpl {...}
          --&gt;
          &lt;bean class="com.example.UserServiceImpl /&gt;
          &lt;bean class="com.example.OrderServiceImpl /&gt;
      &lt;/jaxrs:serviceBeans&gt;
      &lt;jaxrs:providers&gt;
          &lt;bean class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" /&gt;
      &lt;/jaxrs:providers&gt;
  &lt;/jaxrs:server&gt;
  </code></pre>
  
  <p>It seems like it's only a semantic difference. The second way allows us to not repeat the providers. But I was wondering what I should be considering when performing this configuration?</p>
  
  <p>Thank you!</p>