ContainerClassLoader extends ContainerScopeClassLoader { public static ContainerClassLoader newInstance(String applicationName) throws Exception { PropertiesBuilder builder = PropertiesBuilder.fromCurrentNonStandardSystemProperties(); return newInstance(applicationName, ClassPath.ofSystem(), builder.realize(), System.getProperties(), LocalPlatform.get().getAvailablePorts(), false, Container.PIPE_BUFFER_SIZE_BYTES); } private  ContainerClassLoader(ClassPath      classPath,
                                 ClassLoader    parent,
                                 ContainerScope scope); static ContainerClassLoader newInstance(String applicationName); static ContainerClassLoader newInstance(String     applicationName,
                                                   ClassPath  classPath,
                                                   Properties localProperties); ClassPath getClassPath(); void addPackageToLoadFromParent(String packagePrefix); void addPackageToLoadInContainer(String packagePrefix); @Override Class<?> loadClass(String name); @Override URL getResource(String name); static final String PROPERTY_JAVA_CLASS_PATH; static final String PROPERTY_EXCLUDED_PACKAGES; }
@Test public void shouldCorrectlyDetermineScopeFromThread() throws Exception { ContainerClassLoader loader = ContainerClassLoader.newInstance("Test", null, System.getProperties()); Thread thread = Thread.currentThread(); ClassLoader saved = thread.getContextClassLoader(); thread.setContextClassLoader(loader); try { assertThat(loader.getContainerScope(), sameInstance(Container.getContainerScope())); } finally { thread.setContextClassLoader(saved); } }