dispatcher = createDispatcher(providerFactory);
initDispatcher();
// Always use the "deployment sensitive" factory - that means it is handled through ThreadLocal, not static
// TODO: How does that actually work? It's never used because the dispatcher is created with the original one
SeamResteasyProviderFactory.setInstance(new ThreadLocalResteasyProviderFactory(providerFactory));
// Put Providers, Registry and Dispatcher into RESTEasy context.
dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Registry.class, dispatcher.getRegistry());
dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);