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

public class Main {

  public static void main(String[] args) throws Exception {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("context.xml"));
    System.out.println("===============Inheritance demo=================");
    System.out.println(bf.getBean("child"));
    System.out.println(bf.getBean("subchild"));
    
  }
}
class mybean {
  private String name;
  private String address;

  public void setName(String name) {
      this.name = name;
  }

    public void setAddress(String address) {
        this.address = address;
    }
 
  @Override
  public String toString() {
      final StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append("Bean");
      stringBuilder.append("{name='").append(name).append('\'');
      stringBuilder.append(", address=").append(address);
     
      stringBuilder.append('}');
      return stringBuilder.toString();
  }
}