title: Integrating spring-boot with RESTEasy
body: <p>I am trying to prototype a Spring Boot application.  I'm coming from a Guice JAX-RS application, so I prefer the standard JAX-RS annotations to Spring MVC.  I've gotten Jetty up and serving:</p>
  
  <pre><code>@Configuration
  @Import({ResteasyBootstrap.class, SpringBeanProcessorServletAware.class, HttpServletDispatcher.class})
  public class EmbeddedJetty {
      @Bean
      @Singleton
      public EmbeddedServletContainerFactory servletContainer() {
          JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory();
          factory.setPort(9000);
          factory.setSessionTimeout(10, TimeUnit.MINUTES);
          return factory;
      }
  }
  </code></pre>
  
  <p>However, I just can't figure out how to get RESTEasy hooked up correctly.  With the above <code>SpringBeanProcessorServletAware</code> it bails, seemingly the <code>ServletContext</code> is not injected through <code>ServletContextAware</code> before it ends up being used:</p>
  
  <pre><code>java.lang.NullPointerException: null
      at org.jboss.resteasy.plugins.spring.SpringBeanProcessorServletAware.getRegistry(SpringBeanProcessorServletAware.java:30)
      at org.jboss.resteasy.plugins.spring.SpringBeanProcessor.postProcessBeanFactory(SpringBeanProcessor.java:247)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
      at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:174)
      at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:680)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:522)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
  </code></pre>
  
  <p>I also tried using the <code>SpringContextLoaderListener</code>, but that seems to conflict with the spring-boot <code>AnnotationConfigEmbeddedWebApplicationContext</code> class.</p>
  
  <p>I'm using spring-boot 1.3.3 and spring-framework 4.3.0.rc1</p>