factory.setLocation(dynamicClassLocation);
classLoader.setFactory(factory);
// create the bean factory
DynamicBeanFactory beanFactory = new DynamicBeanFactory();
beanFactory.setBeanClassLoader(classLoader);
// create the scope, and register with the bean factory
DynamicScope dynamicScope = new DynamicScope();
dynamicScope.setClassLoader(classLoader);
beanFactory.registerScope("dynamic", dynamicScope);
// create the application context, and set the class loader
GenericApplicationContext context = new GenericApplicationContext(beanFactory);
context.setClassLoader(classLoader);