Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.XmlBeanFactory


    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public static void main(String[] args) throws Exception {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource(
                        "./ch5/src/conf/lifecycle/disposeInterface.xml"));

        DestructiveBeanWithInterface bean = (DestructiveBeanWithInterface) factory.getBean("destructiveBean");

        System.out.println("Calling destroySingletons()");
        factory.destroySingletons();
        System.out.println("Called destroySingletons()");

    }
View Full Code Here


    private Pattern searchPattern;

    private String textToSearch;

    public static void main(String[] args) {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource("./ch5/src/conf/pe/custom.xml"));

        CustomEditorConfigurer config = (CustomEditorConfigurer) factory
                .getBean("customEditorConfigurer");

        config.postProcessBeanFactory(factory);

        CustomEditorExample bean = (CustomEditorExample) factory
                .getBean("exampleBean");

        System.out.println(bean.getMatchCount());
    }
View Full Code Here

* @author robh
*/
public class MethodReplacementExample {

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/mi/replacement.xml"));

        ReplacementTarget replacementTarget = (ReplacementTarget) factory
                .getBean("replacementTarget");
        ReplacementTarget standardTarget = (ReplacementTarget) factory
                .getBean("standardTarget");

        displayInfo(replacementTarget);
        displayInfo(standardTarget);
    }
View Full Code Here

* @author robh
*/
public class AccessingFactoryBeans {

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/factory/factory.xml"));

        MessageDigest digest = (MessageDigest) factory
                .getBean("shaDigest");
      
       
        MessageDigestFactoryBean factoryBean = (MessageDigestFactoryBean) factory
                .getBean("&shaDigest");
    }
View Full Code Here

    public String toString() {
        return "Name: " + name + "\nAge: " + age;
    }

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/lifecycle/initMethod.xml"));

        SimpleBean simpleBean1 = getBean("simpleBean1", factory);       
        SimpleBean simpleBean2 = getBean("simpleBean2", factory);
        SimpleBean simpleBean3 = getBean("simpleBean3", factory);
View Full Code Here

* @author robh
*/
public class MessageDigestExample {

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/factory/factory.xml"));

        MessageDigester digester = (MessageDigester) factory
                .getBean("digester");
        digester.digest("Hello World!");

    }
View Full Code Here

* @author robh
*/
public class LoggingBeanExample {

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/interaction/logging.xml"));
       
        LoggingBean bean = (LoggingBean)factory.getBean("loggingBean");
        bean.someOperation();
    }
View Full Code Here

* @author robh
*/
public class HierarchicalBeanFactoryUsage {

    public static void main(String[] args) {
        BeanFactory parent = new XmlBeanFactory(new FileSystemResource(
                "./ch4/src/conf/parent.xml"));
        BeanFactory child = new XmlBeanFactory(new FileSystemResource(
                "./ch4/src/conf/beans.xml"), parent);

        SimpleTarget target1 = (SimpleTarget) child.getBean("target1");
        SimpleTarget target2 = (SimpleTarget) child.getBean("target2");
        SimpleTarget target3 = (SimpleTarget) child.getBean("target3");

        System.out.println(target1.getVal());
        System.out.println(target2.getVal());
        System.out.println(target3.getVal());
    }
View Full Code Here

* @author robh
*/
public class ShutdownHookBeanExample {

    public static void main(String[] args) {
        ConfigurableListableBeanFactory factory = new XmlBeanFactory(
                new FileSystemResource(
                        "./ch5/src/conf/interaction/shutdownHook.xml"));

        // make sure the shutdown hook is created
        factory.preInstantiateSingletons();

        DestructiveBeanWithInterface bean = (DestructiveBeanWithInterface) factory.getBean("destructiveBean");
    }
View Full Code Here

        mr.render();
    }

    private static BeanFactory getBeanFactory() throws Exception {
        // get the bean factory
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "ch4/src/conf/beans.xml"));

        return factory;
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.XmlBeanFactory

Copyright © 2018 www.massapicom. 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.