class ApplicationPublisher {

    public void publish(Application application) {
        Set<Class<?>> classes = new LinkedHashSet<>();
        Set<Class<?>> appClasses = application.getClasses();
        if (appClasses != null) {
            classes.addAll(appClasses);
        }
        if (application instanceof EverrestApplication) {
            EverrestApplication everrest = (EverrestApplication)application;
            for (Map.Entry<String, Class<?>> e : everrest.getResourceClasses().entrySet()) {
                Class<?> clazz = e.getValue();
                addResource(e.getKey(), clazz);
                classes.remove(clazz);
            }
            for (Map.Entry<String, Object> e : everrest.getResourceSingletons().entrySet()) {
                addResource(e.getKey(), e.getValue());
            }
            for (ObjectFactory<? extends ObjectModel> factory : everrest.getFactories()) {
                addFactory(factory);
                classes.remove(factory.getObjectModel().getObjectClass());
            }
        }
        for (Class<?> clazz : classes) {
            addPerRequest(clazz);
        }
        Set<Object> singletons = application.getSingletons();
        if (singletons != null) {
            for (Object instance : singletons) {
                addSingleton(instance);
            }
        }
    }

    public  ApplicationPublisher(ResourceBinder resources, ProviderBinder providers);
      ApplicationPublisher(ResourceBinder resources, RestComponentResolver componentResolver);

}