WebApplicationContext parent = WebApplicationContextUtils.getWebApplicationContext(framework.getServletContext());
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.setParent(parent);
context.register(classToInstantiate);
context.refresh();
U t = context.getBean(classToInstantiate);
if (framework.objectFactory().getClass().getName().equals("org.atmosphere.inject.InjectableObjectFactory")) {
InjectableObjectFactory.class.cast(framework.objectFactory()).injectAtmosphereInternalObject(t, classToInstantiate, framework);
}