@Test public void testRegistrarUnregistersAllFactoriesWhenRegistrarStops() { withBeanFactory(); withResourceModelsInApplicationContext("bean1", "bean2"); registerResourceModels(); shutdown(); assertRegistrarUnregistersModelFactory(); }
@PreDestroy protected void shutdown() { this.bundlesWithModels.forEach((b, s) -> { try { s.unregister(); } catch (IllegalStateException e) { logger.trace("Cannot unregister the resource model factory service. The service may already have been unregistered.", e); } }); }
SpringModelRegistrar { @PreDestroy protected void shutdown() { this.bundlesWithModels.forEach((b, s) -> { try { s.unregister(); } catch (IllegalStateException e) { logger.trace("Cannot unregister the resource model factory service. The service may already have been unregistered.", e); } }); } }
SpringModelRegistrar { @PreDestroy protected void shutdown() { this.bundlesWithModels.forEach((b, s) -> { try { s.unregister(); } catch (IllegalStateException e) { logger.trace("Cannot unregister the resource model factory service. The service may already have been unregistered.", e); } }); }  }
SpringModelRegistrar { @PreDestroy protected void shutdown() { this.bundlesWithModels.forEach((b, s) -> { try { s.unregister(); } catch (IllegalStateException e) { logger.trace("Cannot unregister the resource model factory service. The service may already have been unregistered.", e); } }); }  void registerModels(BundleContext bundleContext, ConfigurableListableBeanFactory factory); void unregister(Bundle bundle); }
SpringModelRegistrar { @PreDestroy protected void shutdown() { this.bundlesWithModels.forEach((b, s) -> { try { s.unregister(); } catch (IllegalStateException e) { logger.trace("Cannot unregister the resource model factory service. The service may already have been unregistered.", e); } }); }  void registerModels(BundleContext bundleContext, ConfigurableListableBeanFactory factory); void unregister(Bundle bundle);  }