ResteasyEmbeddedServletInitializer implements BeanFactoryPostProcessor { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { logger.debug("Post process bean factory has been called"); findJaxrsApplications(beanFactory); findJaxrsResourcesAndProviderClasses(beanFactory); if (allResources.size() == 0) { logger.warn("No JAX-RS resource Spring beans have been found"); } if (applications.size() == 0) { logger.info("No JAX-RS Application classes have been found. A default, one mapped to '/', will be registered."); registerDefaultJaxrsApp(beanFactory); return; } BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; for (Class<? extends Application> applicationClass : applications) { ApplicationPath path = AnnotationUtils.findAnnotation(applicationClass, ApplicationPath.class); if (path == null) { logger.warn("JAX-RS Application class {} has no ApplicationPath annotation, so it will not be registered", applicationClass.getName()); continue; } logger.debug("registering JAX-RS application class " + applicationClass.getName()); GenericBeanDefinition applicationServletBean = createApplicationServlet(applicationClass, path.value()); registry.registerBeanDefinition(applicationClass.getName(), applicationServletBean); } }  void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory);  }
@Test public void postProcessBeanFactory() { Map<String, ServletRegistrationBean> servletRegistrationBeans = applicationContext.getBeansOfType(ServletRegistrationBean.class); Assert.assertNotNull(servletRegistrationBeans); Assert.assertEquals(servletRegistrationBeans.size(), 4); for(String applicationClassName : servletRegistrationBeans.keySet()) { testApplicaton(applicationClassName, servletRegistrationBeans.get(applicationClassName)); } }