
import java.util.Map;

import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.Assert;

public class Main {

    public static void main(String[] a) {
        XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("context.xml"));

        company mycomp = (company) beanFactory.getBean("company");
        System.out.println("Name of the company is: " + mycomp.Name());
        System.out.println("Address of the company is: " + mycomp.address());
    }
}

interface company {

    String Name();

    String address();
}

interface Detail {

    String find(String entry);
}


class Companyinformation implements company {

    private Detail detail;

    public String Name() {
        String name = this.detail.find("CompanyName");
        return String.valueOf(name);
    }

    public String address() {
        String add = this.detail.find("Address");
        return String.valueOf(add);
    }

    public void setEncyclopedia(Detail d) {
        this.detail = d;
    }
}
class Configure implements Detail {

    private Map map;

    public Configure(Map map) {
        Assert.notNull(map, "Arguments cannot be null.");
        this.map = map;
    }

    public String find(String s) {
        return (String) this.map.get(s);
    }
}
