Package org.springframework.instrument.classloading

Examples of org.springframework.instrument.classloading.ShadowingClassLoader.loadClass()


        // So long as JUnit is excluded from shadowing we
        // can minimize reflective invocation here
        TestCase shadowedTestCase = (TestCase) BeanUtils.instantiateClass(shadowedTestClass);

        /* shadowParent = this */
        Class thisShadowedClass = shadowingClassLoader.loadClass(AbstractJpaTests.class.getName());
        Field shadowed = thisShadowedClass.getDeclaredField("shadowParent");
        shadowed.setAccessible(true);
        shadowed.set(shadowedTestCase, this);

        /* AbstractSpringContextTests.addContext(Object, ApplicationContext) */
 
View Full Code Here


        Field shadowed = thisShadowedClass.getDeclaredField("shadowParent");
        shadowed.setAccessible(true);
        shadowed.set(shadowedTestCase, this);

        /* AbstractSpringContextTests.addContext(Object, ApplicationContext) */
        Class applicationContextClass = shadowingClassLoader.loadClass(ConfigurableApplicationContext.class.getName());
        Method addContextMethod = shadowedTestClass.getMethod("addContext", Object.class, applicationContextClass);
        addContextMethod.invoke(shadowedTestCase, configLocations, cachedContext);

        // Invoke tests on shadowed test case
        shadowedTestCase.setName(getName());
View Full Code Here

        Object cachedContext = contextCache.get(combinationOfContextLocationsForThisTestClass);

        if (cachedContext == null) {

          // Create the LoadTimeWeaver.
          Class shadowingLoadTimeWeaverClass = shadowingClassLoader.loadClass(ShadowingLoadTimeWeaver.class.getName());
          Constructor constructor = shadowingLoadTimeWeaverClass.getConstructor(ClassLoader.class);
          constructor.setAccessible(true);
          Object ltw = constructor.newInstance(shadowingClassLoader);

          // Create the BeanFactory.
View Full Code Here

          Constructor constructor = shadowingLoadTimeWeaverClass.getConstructor(ClassLoader.class);
          constructor.setAccessible(true);
          Object ltw = constructor.newInstance(shadowingClassLoader);

          // Create the BeanFactory.
          Class beanFactoryClass = shadowingClassLoader.loadClass(DefaultListableBeanFactory.class.getName());
          Object beanFactory = BeanUtils.instantiateClass(beanFactoryClass);

          // Create the BeanDefinitionReader.
          Class beanDefinitionReaderClass = shadowingClassLoader.loadClass(XmlBeanDefinitionReader.class.getName());
          Class beanDefinitionRegistryClass = shadowingClassLoader.loadClass(BeanDefinitionRegistry.class.getName());
View Full Code Here

          // Create the BeanFactory.
          Class beanFactoryClass = shadowingClassLoader.loadClass(DefaultListableBeanFactory.class.getName());
          Object beanFactory = BeanUtils.instantiateClass(beanFactoryClass);

          // Create the BeanDefinitionReader.
          Class beanDefinitionReaderClass = shadowingClassLoader.loadClass(XmlBeanDefinitionReader.class.getName());
          Class beanDefinitionRegistryClass = shadowingClassLoader.loadClass(BeanDefinitionRegistry.class.getName());
          Object reader = beanDefinitionReaderClass.getConstructor(beanDefinitionRegistryClass).newInstance(beanFactory);

          // Load the bean definitions into the BeanFactory.
          Method loadBeanDefinitions = beanDefinitionReaderClass.getMethod("loadBeanDefinitions", String[].class);
View Full Code Here

          Class beanFactoryClass = shadowingClassLoader.loadClass(DefaultListableBeanFactory.class.getName());
          Object beanFactory = BeanUtils.instantiateClass(beanFactoryClass);

          // Create the BeanDefinitionReader.
          Class beanDefinitionReaderClass = shadowingClassLoader.loadClass(XmlBeanDefinitionReader.class.getName());
          Class beanDefinitionRegistryClass = shadowingClassLoader.loadClass(BeanDefinitionRegistry.class.getName());
          Object reader = beanDefinitionReaderClass.getConstructor(beanDefinitionRegistryClass).newInstance(beanFactory);

          // Load the bean definitions into the BeanFactory.
          Method loadBeanDefinitions = beanDefinitionReaderClass.getMethod("loadBeanDefinitions", String[].class);
          loadBeanDefinitions.invoke(reader, new Object[] {configLocations});
View Full Code Here

          // Load the bean definitions into the BeanFactory.
          Method loadBeanDefinitions = beanDefinitionReaderClass.getMethod("loadBeanDefinitions", String[].class);
          loadBeanDefinitions.invoke(reader, new Object[] {configLocations});

          // Create LoadTimeWeaver-injecting BeanPostProcessor.
          Class loadTimeWeaverInjectingBeanPostProcessorClass = shadowingClassLoader.loadClass(LoadTimeWeaverInjectingBeanPostProcessor.class.getName());
          Class loadTimeWeaverClass = shadowingClassLoader.loadClass(LoadTimeWeaver.class.getName());
          Constructor bppConstructor = loadTimeWeaverInjectingBeanPostProcessorClass.getConstructor(loadTimeWeaverClass);
          bppConstructor.setAccessible(true);
          Object beanPostProcessor = bppConstructor.newInstance(ltw);
View Full Code Here

          Method loadBeanDefinitions = beanDefinitionReaderClass.getMethod("loadBeanDefinitions", String[].class);
          loadBeanDefinitions.invoke(reader, new Object[] {configLocations});

          // Create LoadTimeWeaver-injecting BeanPostProcessor.
          Class loadTimeWeaverInjectingBeanPostProcessorClass = shadowingClassLoader.loadClass(LoadTimeWeaverInjectingBeanPostProcessor.class.getName());
          Class loadTimeWeaverClass = shadowingClassLoader.loadClass(LoadTimeWeaver.class.getName());
          Constructor bppConstructor = loadTimeWeaverInjectingBeanPostProcessorClass.getConstructor(loadTimeWeaverClass);
          bppConstructor.setAccessible(true);
          Object beanPostProcessor = bppConstructor.newInstance(ltw);

          // Add LoadTimeWeaver-injecting BeanPostProcessor.
View Full Code Here

          Constructor bppConstructor = loadTimeWeaverInjectingBeanPostProcessorClass.getConstructor(loadTimeWeaverClass);
          bppConstructor.setAccessible(true);
          Object beanPostProcessor = bppConstructor.newInstance(ltw);

          // Add LoadTimeWeaver-injecting BeanPostProcessor.
          Class beanPostProcessorClass = shadowingClassLoader.loadClass(BeanPostProcessor.class.getName());
          Method addBeanPostProcessor = beanFactoryClass.getMethod("addBeanPostProcessor", beanPostProcessorClass);
          addBeanPostProcessor.invoke(beanFactory, beanPostProcessor);

          // Create the GenericApplicationContext.
          Class genericApplicationContextClass = shadowingClassLoader.loadClass(GenericApplicationContext.class.getName());
View Full Code Here

          Class beanPostProcessorClass = shadowingClassLoader.loadClass(BeanPostProcessor.class.getName());
          Method addBeanPostProcessor = beanFactoryClass.getMethod("addBeanPostProcessor", beanPostProcessorClass);
          addBeanPostProcessor.invoke(beanFactory, beanPostProcessor);

          // Create the GenericApplicationContext.
          Class genericApplicationContextClass = shadowingClassLoader.loadClass(GenericApplicationContext.class.getName());
          Class defaultListableBeanFactoryClass = shadowingClassLoader.loadClass(DefaultListableBeanFactory.class.getName());
          cachedContext = genericApplicationContextClass.getConstructor(defaultListableBeanFactoryClass).newInstance(beanFactory);

          // Invoke the context's "refresh" method.
          genericApplicationContextClass.getMethod("refresh").invoke(cachedContext);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.