ModuleLocationResolver resolver = new StandaloneModuleLocationResolver();
CustomClassLoaderFactory classLoaderFactory = new CustomClassLoaderFactory();
classLoaderFactory.setModuleLocationResolver(resolver);
ApplicationModuleLoader rootModuleLoader = new ApplicationModuleLoader();
registry.addItem("spring-"+ModuleTypes.ROOT, rootModuleLoader);
ApplicationModuleLoader applicationModuleLoader = new ApplicationModuleLoader();
registry.addItem("spring-"+ModuleTypes.APPLICATION, applicationModuleLoader);
DefaultApplicationContextLoader contextLoader = new DefaultApplicationContextLoader();
contextLoader.setModuleLoaderRegistry(registry);
contextLoader.setDelegatingContextLoaderRegistry(new DelegatingContextLoaderRegistry());