Dashboard > Public Content > ... > Spring > Making Everything lazy-init
  Public Content Log In   View a printable version of the current page.  
  Making Everything lazy-init
Added by James Richardson, last edited by James Richardson on Jun 28, 2006
Labels: 
(None)

public class Junk extends TestCase {



    public void testnothing() throws Exception {

        BeanFactory factory = new JamesClasspathXMLApplicationConext("config.xml");
    }

    public static class JamesClasspathXMLApplicationConext extends ClassPathXmlApplicationContext {
        public JamesClasspathXMLApplicationConext(String configLocation) throws BeansException {
            super(configLocation);
        }

        public JamesClasspathXMLApplicationConext(String[] configLocations) throws BeansException {
            super(configLocations);
        }

        public JamesClasspathXMLApplicationConext(String[] configLocations, boolean refresh) throws BeansException {
            super(configLocations, refresh);
        }

        public JamesClasspathXMLApplicationConext(String[] configLocations, ApplicationContext parent) throws BeansException {
            super(configLocations, parent);
        }

        public JamesClasspathXMLApplicationConext(String[] configLocations, boolean refresh, ApplicationContext parent) throws BeansException {
            super(configLocations, refresh, parent);
        }


        protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
            super.initBeanDefinitionReader(beanDefinitionReader);
            beanDefinitionReader.setParserClass(JamesParserClass.class);
        }

    }

    public static class JamesParserClass extends DefaultXmlBeanDefinitionParser {
        protected void initDefaults(Element root) {
            super.initDefaults(root);
            setDefaultLazyInit("true");
        }
    }

}
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators