title: Embedded Jetty and Jax-rs xml configuration
body: <p>Hey guys i am trying to configure and run a Restful service using Embedded-jetty and jax-rs i found this <a href="http://java.dzone.com/articles/going-restnoxml-embedding" rel="nofollow">tutorial</a> and it works brilliantly however one of my requirements is to configure as much as possible through spring xml in the applicationContext.xml file.</p>
  
  <p>The part i would like to do in xml is the AppConfig.java class</p>
  
  <pre><code>    @Configuration
  public class AppConfig { 
      @Bean( destroyMethod = "shutdown" )
      public SpringBus cxf() {
          return new SpringBus();
      }
  
      @Bean
      public Server jaxRsServer() {
          JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint( jaxRsApiApplication(), JAXRSServerFactoryBean.class );
          factory.setServiceBeans( Arrays.&lt; Object &gt;asList( peopleRestService() ) );
          factory.setAddress( '/' + factory.getAddress() );
          factory.setProviders( Arrays.&lt; Object &gt;asList( jsonProvider() ) );
          return factory.create();
      }
  
      @Bean 
      public JaxRsApiApplication jaxRsApiApplication() {
          return new JaxRsApiApplication();
      }
  
      @Bean 
      public StatsRestService peopleRestService() {
          return new StatsRestService();
      }
  
      @Bean 
      public StatsService peopleService() {
          return new StatsService();
      }
  
      @Bean
      public JacksonJsonProvider jsonProvider() {
          return new JacksonJsonProvider();
      }
  }
  </code></pre>
  
  <p>and where it is used</p>
  
  <pre><code>context.setInitParameter( "contextClass", AnnotationConfigWebApplicationContext.class.getName() );
  context.setInitParameter( "contextConfigLocation", AppConfig.class.getName() );
  </code></pre>
  
  <p>unfortunately i can not find any decent posts online on how to do this in XML, i would greatly appreciate some help.</p>